httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1591622 [17/33] - in /httpd/mod_spdy/trunk: ./ base/ base/base.xcodeproj/ base/metrics/ build/ build/all.xcodeproj/ build/build_util.xcodeproj/ build/install.xcodeproj/ build/internal/ build/linux/ build/mac/ build/util/ build/win/ install...
Date Thu, 01 May 2014 11:43:45 GMT
Added: httpd/mod_spdy/trunk/mod_spdy/spdy_apache.target.mk
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/spdy_apache.target.mk?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/spdy_apache.target.mk (added)
+++ httpd/mod_spdy/trunk/mod_spdy/spdy_apache.target.mk Thu May  1 11:43:36 2014
@@ -0,0 +1,186 @@
+# This file is generated by gyp; do not edit.
+
+TOOLSET := target
+TARGET := spdy_apache
+DEFS_Debug := \
+	'-D_LARGEFILE64_SOURCE' \
+	'-DHAVE_CONFIG_H' \
+	'-DLINUX=2' \
+	'-D_REENTRANT' \
+	'-D_GNU_SOURCE' \
+	'-D__STDC_FORMAT_MACROS' \
+	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
+	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
+	'-D_DEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Debug := \
+	 \
+	-pthread \
+	-fno-exceptions \
+	-Wall \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-D_FILE_OFFSET_BITS=64 \
+	-fvisibility=hidden \
+	-pipe \
+	-std=gnu++0x \
+	-fPIC \
+	-fno-strict-aliasing \
+	-O0 \
+	-g
+
+# Flags passed to only C files.
+CFLAGS_C_Debug :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Debug := \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden
+
+INCS_Debug := \
+	-Ithird_party/chromium/src \
+	-I. \
+	-I$(obj)/gen \
+	-Ithird_party/apache/httpd/src/include \
+	-Ithird_party/apache/httpd/src/os/unix \
+	-Ithird_party/apache/httpd/gen/arch/linux/x64/include \
+	-Ithird_party/apache/apr/src/include \
+	-Ithird_party/apache/apr/src/include/arch/unix \
+	-Ithird_party/apache/apr/gen/arch/linux/x64/include \
+	-Ithird_party/apache/aprutil/src/include \
+	-Ithird_party/apache/aprutil/gen/arch/linux/x64/include
+
+DEFS_Release := \
+	'-D_LARGEFILE64_SOURCE' \
+	'-DHAVE_CONFIG_H' \
+	'-DLINUX=2' \
+	'-D_REENTRANT' \
+	'-D_GNU_SOURCE' \
+	'-D__STDC_FORMAT_MACROS' \
+	'-DNDEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Release := \
+	 \
+	-pthread \
+	-fno-exceptions \
+	-Wall \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-D_FILE_OFFSET_BITS=64 \
+	-fvisibility=hidden \
+	-pipe \
+	-std=gnu++0x \
+	-fPIC \
+	-fno-strict-aliasing \
+	-O2 \
+	-fno-ident \
+	-fdata-sections \
+	-ffunction-sections
+
+# Flags passed to only C files.
+CFLAGS_C_Release :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Release := \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden
+
+INCS_Release := \
+	-Ithird_party/chromium/src \
+	-I. \
+	-I$(obj)/gen \
+	-Ithird_party/apache/httpd/src/include \
+	-Ithird_party/apache/httpd/src/os/unix \
+	-Ithird_party/apache/httpd/gen/arch/linux/x64/include \
+	-Ithird_party/apache/apr/src/include \
+	-Ithird_party/apache/apr/src/include/arch/unix \
+	-Ithird_party/apache/apr/gen/arch/linux/x64/include \
+	-Ithird_party/apache/aprutil/src/include \
+	-Ithird_party/apache/aprutil/gen/arch/linux/x64/include
+
+OBJS := \
+	$(obj).target/$(TARGET)/mod_spdy/apache/apache_spdy_session_io.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/apache_spdy_stream_task_factory.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/config_commands.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/config_util.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/filters/http_to_spdy_filter.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/filters/server_push_filter.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/filters/spdy_to_http_filter.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/id_pool.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/log_message_handler.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/master_connection_context.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/pool_util.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/sockaddr_util.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/slave_connection.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/slave_connection_api.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/slave_connection_context.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/ssl_util.o
+
+# Add to the list of files we specially track dependencies for.
+all_deps += $(OBJS)
+
+# Make sure our dependencies are built before any of us.
+$(OBJS): | $(obj).target/build/mod_spdy_version_header.stamp $(obj).target/third_party/apache/httpd/include.stamp
+
+# CFLAGS et al overrides must be target-local.
+# See "Target-specific Variable Values" in the GNU Make manual.
+$(OBJS): TOOLSET := $(TOOLSET)
+$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
+$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
+
+# Suffix rules, putting all outputs into $(obj).
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
+	@$(call do_cmd,cc,1)
+
+# Try building from generated source, too.
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
+	@$(call do_cmd,cc,1)
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD
+	@$(call do_cmd,cc,1)
+
+# End of this set of suffix rules
+### Rules for final target.
+LDFLAGS_Debug := \
+	-pthread \
+	-Wl,-z,noexecstack
+
+LDFLAGS_Release := \
+	-pthread \
+	-Wl,-z,noexecstack \
+	-Wl,-O1 \
+	-Wl,--as-needed \
+	-Wl,--gc-sections
+
+LIBS :=
+
+$(obj).target/mod_spdy/libspdy_apache.a: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
+$(obj).target/mod_spdy/libspdy_apache.a: LIBS := $(LIBS)
+$(obj).target/mod_spdy/libspdy_apache.a: TOOLSET := $(TOOLSET)
+$(obj).target/mod_spdy/libspdy_apache.a: $(OBJS) FORCE_DO_CMD
+	$(call do_cmd,alink)
+
+all_deps += $(obj).target/mod_spdy/libspdy_apache.a
+# Add target alias
+.PHONY: spdy_apache
+spdy_apache: $(obj).target/mod_spdy/libspdy_apache.a
+
+# Add target alias to "all" target.
+.PHONY: all
+all: spdy_apache
+

Added: httpd/mod_spdy/trunk/mod_spdy/spdy_apache_test.target.mk
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/spdy_apache_test.target.mk?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/spdy_apache_test.target.mk (added)
+++ httpd/mod_spdy/trunk/mod_spdy/spdy_apache_test.target.mk Thu May  1 11:43:36 2014
@@ -0,0 +1,180 @@
+# This file is generated by gyp; do not edit.
+
+TOOLSET := target
+TARGET := spdy_apache_test
+DEFS_Debug := \
+	'-D_LARGEFILE64_SOURCE' \
+	'-DHAVE_CONFIG_H' \
+	'-DLINUX=2' \
+	'-D_REENTRANT' \
+	'-D_GNU_SOURCE' \
+	'-DUNIT_TEST' \
+	'-DGTEST_HAS_RTTI=0' \
+	'-D__STDC_FORMAT_MACROS' \
+	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
+	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
+	'-D_DEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Debug := \
+	 \
+	-pthread \
+	-fno-exceptions \
+	-Wall \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-D_FILE_OFFSET_BITS=64 \
+	-fvisibility=hidden \
+	-pipe \
+	-std=gnu++0x \
+	-fPIC \
+	-fno-strict-aliasing \
+	-O0 \
+	-g
+
+# Flags passed to only C files.
+CFLAGS_C_Debug :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Debug := \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden
+
+INCS_Debug := \
+	-Ithird_party/chromium/src \
+	-I. \
+	-Ithird_party/apache/httpd/src/include \
+	-Ithird_party/apache/httpd/src/os/unix \
+	-Ithird_party/apache/httpd/gen/arch/linux/x64/include \
+	-Ithird_party/apache/apr/src/include \
+	-Ithird_party/apache/apr/src/include/arch/unix \
+	-Ithird_party/apache/apr/gen/arch/linux/x64/include \
+	-Ithird_party/apache/aprutil/src/include \
+	-Ithird_party/apache/aprutil/gen/arch/linux/x64/include \
+	-Itesting/gmock/include \
+	-I$(obj)/gen \
+	-Itesting/gtest/include
+
+DEFS_Release := \
+	'-D_LARGEFILE64_SOURCE' \
+	'-DHAVE_CONFIG_H' \
+	'-DLINUX=2' \
+	'-D_REENTRANT' \
+	'-D_GNU_SOURCE' \
+	'-DUNIT_TEST' \
+	'-DGTEST_HAS_RTTI=0' \
+	'-D__STDC_FORMAT_MACROS' \
+	'-DNDEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Release := \
+	 \
+	-pthread \
+	-fno-exceptions \
+	-Wall \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-D_FILE_OFFSET_BITS=64 \
+	-fvisibility=hidden \
+	-pipe \
+	-std=gnu++0x \
+	-fPIC \
+	-fno-strict-aliasing \
+	-O2 \
+	-fno-ident \
+	-fdata-sections \
+	-ffunction-sections
+
+# Flags passed to only C files.
+CFLAGS_C_Release :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Release := \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden
+
+INCS_Release := \
+	-Ithird_party/chromium/src \
+	-I. \
+	-Ithird_party/apache/httpd/src/include \
+	-Ithird_party/apache/httpd/src/os/unix \
+	-Ithird_party/apache/httpd/gen/arch/linux/x64/include \
+	-Ithird_party/apache/apr/src/include \
+	-Ithird_party/apache/apr/src/include/arch/unix \
+	-Ithird_party/apache/apr/gen/arch/linux/x64/include \
+	-Ithird_party/apache/aprutil/src/include \
+	-Ithird_party/apache/aprutil/gen/arch/linux/x64/include \
+	-Itesting/gmock/include \
+	-I$(obj)/gen \
+	-Itesting/gtest/include
+
+OBJS := \
+	$(obj).target/$(TARGET)/mod_spdy/apache/filters/http_to_spdy_filter_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/filters/server_push_filter_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/filters/spdy_to_http_filter_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/id_pool_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/pool_util_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/sockaddr_util_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/testing/dummy_util_filter.o \
+	$(obj).target/$(TARGET)/mod_spdy/apache/testing/spdy_apache_test_main.o
+
+# Add to the list of files we specially track dependencies for.
+all_deps += $(OBJS)
+
+# Make sure our dependencies are built before any of us.
+$(OBJS): | $(obj).target/mod_spdy/libspdy_apache.a $(obj).target/mod_spdy/libspdy_common_testing.a $(obj).target/build/mod_spdy_version_header.stamp $(obj).target/testing/libgtest.a $(obj).target/third_party/apache/apr/libapr.a $(obj).target/third_party/apache/aprutil/libaprutil.a $(obj).target/mod_spdy/libspdy_common.a $(obj).target/base/libbase.a $(obj).target/base/libbase_static.a $(obj).target/third_party/modp_b64/libmodp_b64.a $(obj).target/third_party/chromium/src/base/third_party/dynamic_annotations/libdynamic_annotations.a $(obj).target/build/lastchange.stamp $(obj).target/net/libinstaweb_util.a $(obj).target/net/libspdy.a $(obj).target/third_party/zlib/libchrome_zlib.a $(obj).target/third_party/apache/httpd/include.stamp $(obj).target/third_party/apache/apr/include.stamp $(obj).target/third_party/apache/aprutil/include.stamp $(obj).target/testing/libgmock.a $(obj).target/testing/gtest_prod.stamp
+
+# CFLAGS et al overrides must be target-local.
+# See "Target-specific Variable Values" in the GNU Make manual.
+$(OBJS): TOOLSET := $(TOOLSET)
+$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
+$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
+
+# Suffix rules, putting all outputs into $(obj).
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+# Try building from generated source, too.
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+# End of this set of suffix rules
+### Rules for final target.
+LDFLAGS_Debug := \
+	-pthread \
+	-Wl,-z,noexecstack
+
+LDFLAGS_Release := \
+	-pthread \
+	-Wl,-z,noexecstack \
+	-Wl,-O1 \
+	-Wl,--as-needed \
+	-Wl,--gc-sections
+
+LIBS := \
+	-lrt \
+	-ldl
+
+$(builddir)/spdy_apache_test: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
+$(builddir)/spdy_apache_test: LIBS := $(LIBS)
+$(builddir)/spdy_apache_test: LD_INPUTS := $(OBJS) $(obj).target/mod_spdy/libspdy_apache.a $(obj).target/mod_spdy/libspdy_common_testing.a $(obj).target/testing/libgtest.a $(obj).target/third_party/apache/apr/libapr.a $(obj).target/third_party/apache/aprutil/libaprutil.a $(obj).target/mod_spdy/libspdy_common.a $(obj).target/base/libbase.a $(obj).target/base/libbase_static.a $(obj).target/third_party/modp_b64/libmodp_b64.a $(obj).target/third_party/chromium/src/base/third_party/dynamic_annotations/libdynamic_annotations.a $(obj).target/net/libinstaweb_util.a $(obj).target/net/libspdy.a $(obj).target/third_party/zlib/libchrome_zlib.a $(obj).target/testing/libgmock.a
+$(builddir)/spdy_apache_test: TOOLSET := $(TOOLSET)
+$(builddir)/spdy_apache_test: $(OBJS) $(obj).target/mod_spdy/libspdy_apache.a $(obj).target/mod_spdy/libspdy_common_testing.a $(obj).target/testing/libgtest.a $(obj).target/third_party/apache/apr/libapr.a $(obj).target/third_party/apache/aprutil/libaprutil.a $(obj).target/mod_spdy/libspdy_common.a $(obj).target/base/libbase.a $(obj).target/base/libbase_static.a $(obj).target/third_party/modp_b64/libmodp_b64.a $(obj).target/third_party/chromium/src/base/third_party/dynamic_annotations/libdynamic_annotations.a $(obj).target/net/libinstaweb_util.a $(obj).target/net/libspdy.a $(obj).target/third_party/zlib/libchrome_zlib.a $(obj).target/testing/libgmock.a FORCE_DO_CMD
+	$(call do_cmd,link)
+
+all_deps += $(builddir)/spdy_apache_test
+# Add target alias
+.PHONY: spdy_apache_test
+spdy_apache_test: $(builddir)/spdy_apache_test
+
+# Add executable to "all" target.
+.PHONY: all
+all: $(builddir)/spdy_apache_test
+

Added: httpd/mod_spdy/trunk/mod_spdy/spdy_common.target.mk
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/spdy_common.target.mk?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/spdy_common.target.mk (added)
+++ httpd/mod_spdy/trunk/mod_spdy/spdy_common.target.mk Thu May  1 11:43:36 2014
@@ -0,0 +1,152 @@
+# This file is generated by gyp; do not edit.
+
+TOOLSET := target
+TARGET := spdy_common
+DEFS_Debug := \
+	'-D__STDC_FORMAT_MACROS' \
+	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
+	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
+	'-D_DEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Debug := \
+	 \
+	-pthread \
+	-fno-exceptions \
+	-Wall \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-D_FILE_OFFSET_BITS=64 \
+	-fvisibility=hidden \
+	-pipe \
+	-std=gnu++0x \
+	-fPIC \
+	-fno-strict-aliasing \
+	-O0 \
+	-g
+
+# Flags passed to only C files.
+CFLAGS_C_Debug :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Debug := \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden
+
+INCS_Debug := \
+	-Ithird_party/chromium/src \
+	-I. \
+	-I$(obj)/gen
+
+DEFS_Release := \
+	'-D__STDC_FORMAT_MACROS' \
+	'-DNDEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Release := \
+	 \
+	-pthread \
+	-fno-exceptions \
+	-Wall \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-D_FILE_OFFSET_BITS=64 \
+	-fvisibility=hidden \
+	-pipe \
+	-std=gnu++0x \
+	-fPIC \
+	-fno-strict-aliasing \
+	-O2 \
+	-fno-ident \
+	-fdata-sections \
+	-ffunction-sections
+
+# Flags passed to only C files.
+CFLAGS_C_Release :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Release := \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden
+
+INCS_Release := \
+	-Ithird_party/chromium/src \
+	-I. \
+	-I$(obj)/gen
+
+OBJS := \
+	$(obj).target/$(TARGET)/mod_spdy/common/executor.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/http_request_visitor_interface.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/http_response_parser.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/http_response_visitor_interface.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/http_string_builder.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/http_to_spdy_converter.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/protocol_util.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_frame_priority_queue.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_frame_queue.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_server_config.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_server_push_interface.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_session.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_session_io.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_stream.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_stream_task_factory.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_to_http_converter.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/thread_pool.o
+
+# Add to the list of files we specially track dependencies for.
+all_deps += $(OBJS)
+
+# Make sure our dependencies are built before any of us.
+$(OBJS): | $(obj).target/build/mod_spdy_version_header.stamp
+
+# CFLAGS et al overrides must be target-local.
+# See "Target-specific Variable Values" in the GNU Make manual.
+$(OBJS): TOOLSET := $(TOOLSET)
+$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
+$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
+
+# Suffix rules, putting all outputs into $(obj).
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+# Try building from generated source, too.
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+# End of this set of suffix rules
+### Rules for final target.
+LDFLAGS_Debug := \
+	-pthread \
+	-Wl,-z,noexecstack
+
+LDFLAGS_Release := \
+	-pthread \
+	-Wl,-z,noexecstack \
+	-Wl,-O1 \
+	-Wl,--as-needed \
+	-Wl,--gc-sections
+
+LIBS :=
+
+$(obj).target/mod_spdy/libspdy_common.a: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
+$(obj).target/mod_spdy/libspdy_common.a: LIBS := $(LIBS)
+$(obj).target/mod_spdy/libspdy_common.a: TOOLSET := $(TOOLSET)
+$(obj).target/mod_spdy/libspdy_common.a: $(OBJS) FORCE_DO_CMD
+	$(call do_cmd,alink)
+
+all_deps += $(obj).target/mod_spdy/libspdy_common.a
+# Add target alias
+.PHONY: spdy_common
+spdy_common: $(obj).target/mod_spdy/libspdy_common.a
+
+# Add target alias to "all" target.
+.PHONY: all
+all: spdy_common
+

Added: httpd/mod_spdy/trunk/mod_spdy/spdy_common_test.target.mk
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/spdy_common_test.target.mk?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/spdy_common_test.target.mk (added)
+++ httpd/mod_spdy/trunk/mod_spdy/spdy_common_test.target.mk Thu May  1 11:43:36 2014
@@ -0,0 +1,152 @@
+# This file is generated by gyp; do not edit.
+
+TOOLSET := target
+TARGET := spdy_common_test
+DEFS_Debug := \
+	'-DUNIT_TEST' \
+	'-DGTEST_HAS_RTTI=0' \
+	'-D__STDC_FORMAT_MACROS' \
+	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
+	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
+	'-D_DEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Debug := \
+	 \
+	-pthread \
+	-fno-exceptions \
+	-Wall \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-D_FILE_OFFSET_BITS=64 \
+	-fvisibility=hidden \
+	-pipe \
+	-std=gnu++0x \
+	-fPIC \
+	-fno-strict-aliasing \
+	-O0 \
+	-g
+
+# Flags passed to only C files.
+CFLAGS_C_Debug :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Debug := \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden
+
+INCS_Debug := \
+	-Ithird_party/chromium/src \
+	-I. \
+	-Itesting/gmock/include \
+	-Itesting/gtest/include
+
+DEFS_Release := \
+	'-DUNIT_TEST' \
+	'-DGTEST_HAS_RTTI=0' \
+	'-D__STDC_FORMAT_MACROS' \
+	'-DNDEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Release := \
+	 \
+	-pthread \
+	-fno-exceptions \
+	-Wall \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-D_FILE_OFFSET_BITS=64 \
+	-fvisibility=hidden \
+	-pipe \
+	-std=gnu++0x \
+	-fPIC \
+	-fno-strict-aliasing \
+	-O2 \
+	-fno-ident \
+	-fdata-sections \
+	-ffunction-sections
+
+# Flags passed to only C files.
+CFLAGS_C_Release :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Release := \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden
+
+INCS_Release := \
+	-Ithird_party/chromium/src \
+	-I. \
+	-Itesting/gmock/include \
+	-Itesting/gtest/include
+
+OBJS := \
+	$(obj).target/$(TARGET)/mod_spdy/common/http_response_parser_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/http_to_spdy_converter_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/protocol_util_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_frame_priority_queue_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_frame_queue_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_session_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_stream_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/spdy_to_http_converter_test.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/thread_pool_test.o
+
+# Add to the list of files we specially track dependencies for.
+all_deps += $(OBJS)
+
+# Make sure our dependencies are built before any of us.
+$(OBJS): | $(obj).target/mod_spdy/libspdy_common.a $(obj).target/mod_spdy/libspdy_common_testing.a $(obj).target/testing/libgmock.a $(obj).target/testing/libgtest.a $(obj).target/testing/libgtest_main.a $(obj).target/base/libbase.a $(obj).target/base/libbase_static.a $(obj).target/third_party/modp_b64/libmodp_b64.a $(obj).target/third_party/chromium/src/base/third_party/dynamic_annotations/libdynamic_annotations.a $(obj).target/build/mod_spdy_version_header.stamp $(obj).target/build/lastchange.stamp $(obj).target/net/libinstaweb_util.a $(obj).target/net/libspdy.a $(obj).target/third_party/zlib/libchrome_zlib.a $(obj).target/testing/gtest_prod.stamp
+
+# CFLAGS et al overrides must be target-local.
+# See "Target-specific Variable Values" in the GNU Make manual.
+$(OBJS): TOOLSET := $(TOOLSET)
+$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
+$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
+
+# Suffix rules, putting all outputs into $(obj).
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+# Try building from generated source, too.
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+# End of this set of suffix rules
+### Rules for final target.
+LDFLAGS_Debug := \
+	-pthread \
+	-Wl,-z,noexecstack
+
+LDFLAGS_Release := \
+	-pthread \
+	-Wl,-z,noexecstack \
+	-Wl,-O1 \
+	-Wl,--as-needed \
+	-Wl,--gc-sections
+
+LIBS := \
+	-lrt
+
+$(builddir)/spdy_common_test: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
+$(builddir)/spdy_common_test: LIBS := $(LIBS)
+$(builddir)/spdy_common_test: LD_INPUTS := $(OBJS) $(obj).target/mod_spdy/libspdy_common.a $(obj).target/mod_spdy/libspdy_common_testing.a $(obj).target/testing/libgmock.a $(obj).target/testing/libgtest.a $(obj).target/testing/libgtest_main.a $(obj).target/base/libbase.a $(obj).target/base/libbase_static.a $(obj).target/third_party/modp_b64/libmodp_b64.a $(obj).target/third_party/chromium/src/base/third_party/dynamic_annotations/libdynamic_annotations.a $(obj).target/net/libinstaweb_util.a $(obj).target/net/libspdy.a $(obj).target/third_party/zlib/libchrome_zlib.a
+$(builddir)/spdy_common_test: TOOLSET := $(TOOLSET)
+$(builddir)/spdy_common_test: $(OBJS) $(obj).target/mod_spdy/libspdy_common.a $(obj).target/mod_spdy/libspdy_common_testing.a $(obj).target/testing/libgmock.a $(obj).target/testing/libgtest.a $(obj).target/testing/libgtest_main.a $(obj).target/base/libbase.a $(obj).target/base/libbase_static.a $(obj).target/third_party/modp_b64/libmodp_b64.a $(obj).target/third_party/chromium/src/base/third_party/dynamic_annotations/libdynamic_annotations.a $(obj).target/net/libinstaweb_util.a $(obj).target/net/libspdy.a $(obj).target/third_party/zlib/libchrome_zlib.a FORCE_DO_CMD
+	$(call do_cmd,link)
+
+all_deps += $(builddir)/spdy_common_test
+# Add target alias
+.PHONY: spdy_common_test
+spdy_common_test: $(builddir)/spdy_common_test
+
+# Add executable to "all" target.
+.PHONY: all
+all: $(builddir)/spdy_common_test
+

Added: httpd/mod_spdy/trunk/mod_spdy/spdy_common_testing.target.mk
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/mod_spdy/spdy_common_testing.target.mk?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/mod_spdy/spdy_common_testing.target.mk (added)
+++ httpd/mod_spdy/trunk/mod_spdy/spdy_common_testing.target.mk Thu May  1 11:43:36 2014
@@ -0,0 +1,141 @@
+# This file is generated by gyp; do not edit.
+
+TOOLSET := target
+TARGET := spdy_common_testing
+DEFS_Debug := \
+	'-DUNIT_TEST' \
+	'-DGTEST_HAS_RTTI=0' \
+	'-D__STDC_FORMAT_MACROS' \
+	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
+	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
+	'-D_DEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Debug := \
+	 \
+	-pthread \
+	-fno-exceptions \
+	-Wall \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-D_FILE_OFFSET_BITS=64 \
+	-fvisibility=hidden \
+	-pipe \
+	-std=gnu++0x \
+	-fPIC \
+	-fno-strict-aliasing \
+	-O0 \
+	-g
+
+# Flags passed to only C files.
+CFLAGS_C_Debug :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Debug := \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden
+
+INCS_Debug := \
+	-Ithird_party/chromium/src \
+	-I. \
+	-Itesting/gmock/include \
+	-Itesting/gtest/include
+
+DEFS_Release := \
+	'-DUNIT_TEST' \
+	'-DGTEST_HAS_RTTI=0' \
+	'-D__STDC_FORMAT_MACROS' \
+	'-DNDEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Release := \
+	 \
+	-pthread \
+	-fno-exceptions \
+	-Wall \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-D_FILE_OFFSET_BITS=64 \
+	-fvisibility=hidden \
+	-pipe \
+	-std=gnu++0x \
+	-fPIC \
+	-fno-strict-aliasing \
+	-O2 \
+	-fno-ident \
+	-fdata-sections \
+	-ffunction-sections
+
+# Flags passed to only C files.
+CFLAGS_C_Release :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Release := \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden
+
+INCS_Release := \
+	-Ithird_party/chromium/src \
+	-I. \
+	-Itesting/gmock/include \
+	-Itesting/gtest/include
+
+OBJS := \
+	$(obj).target/$(TARGET)/mod_spdy/common/testing/async_task_runner.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/testing/notification.o \
+	$(obj).target/$(TARGET)/mod_spdy/common/testing/spdy_frame_matchers.o
+
+# Add to the list of files we specially track dependencies for.
+all_deps += $(OBJS)
+
+# CFLAGS et al overrides must be target-local.
+# See "Target-specific Variable Values" in the GNU Make manual.
+$(OBJS): TOOLSET := $(TOOLSET)
+$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
+$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE))  $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
+
+# Suffix rules, putting all outputs into $(obj).
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+# Try building from generated source, too.
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
+	@$(call do_cmd,cxx,1)
+
+# End of this set of suffix rules
+### Rules for final target.
+LDFLAGS_Debug := \
+	-pthread \
+	-Wl,-z,noexecstack
+
+LDFLAGS_Release := \
+	-pthread \
+	-Wl,-z,noexecstack \
+	-Wl,-O1 \
+	-Wl,--as-needed \
+	-Wl,--gc-sections
+
+LIBS :=
+
+$(obj).target/mod_spdy/libspdy_common_testing.a: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
+$(obj).target/mod_spdy/libspdy_common_testing.a: LIBS := $(LIBS)
+$(obj).target/mod_spdy/libspdy_common_testing.a: TOOLSET := $(TOOLSET)
+$(obj).target/mod_spdy/libspdy_common_testing.a: $(OBJS) FORCE_DO_CMD
+	$(call do_cmd,alink)
+
+all_deps += $(obj).target/mod_spdy/libspdy_common_testing.a
+# Add target alias
+.PHONY: spdy_common_testing
+spdy_common_testing: $(obj).target/mod_spdy/libspdy_common_testing.a
+
+# Add target alias to "all" target.
+.PHONY: all
+all: spdy_common_testing
+

Added: httpd/mod_spdy/trunk/net/instaweb/util/abstract_mutex.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/abstract_mutex.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/abstract_mutex.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/abstract_mutex.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: jmarantz@google.com (Joshua Marantz)
+
+#include "net/instaweb/util/public/abstract_mutex.h"
+
+namespace net_instaweb {
+
+AbstractMutex::~AbstractMutex() {
+}
+
+void AbstractMutex::DCheckLocked() {
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/abstract_shared_mem.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/abstract_shared_mem.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/abstract_shared_mem.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/abstract_shared_mem.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: morlovich@google.com (Maksim Orlovich)
+
+#include "net/instaweb/util/public/abstract_shared_mem.h"
+
+namespace net_instaweb {
+
+AbstractSharedMemSegment::~AbstractSharedMemSegment() {
+}
+
+AbstractSharedMem::~AbstractSharedMem() {
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/arena_test.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/arena_test.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/arena_test.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/arena_test.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: morlovich@google.com (Maksim Orlovich)
+
+// Unit-test the arena
+
+#include "net/instaweb/util/public/arena.h"
+
+#include <cstddef>
+#include <set>
+
+#include "net/instaweb/util/public/gtest.h"
+
+namespace net_instaweb {
+
+class ArenaTest : public testing::Test {
+ public:
+  ArenaTest() {
+    ClearStats();
+  }
+
+ protected:
+  friend class KidA;
+  friend class KidB;
+
+  class Base {
+   public:
+    explicit Base(ArenaTest* owner) : owner_(owner) {}
+    virtual ~Base() {
+      // Watch out for double-delete
+      EXPECT_TRUE(owner_ != NULL);
+      owner_ = NULL;
+    }
+
+    // When testing creation, we invoke this method.
+    virtual void Made() = 0;
+
+    void* operator new(size_t size, Arena<Base>* arena) {
+      return arena->Allocate(size);
+    }
+
+   protected:
+    ArenaTest* owner_;
+  };
+
+  // We expect KidA to have size of 2 pointers: the vtable and owner,
+  // (just like base). On 32-bit this will be 8-bytes, so with 8-byte
+  // alignment area it will divide the block size
+  class KidA : public Base {
+   public:
+    explicit KidA(ArenaTest* o) : Base(o) {}
+
+    ~KidA() {
+      ++owner_->destroyed_a_;
+    }
+
+    virtual void Made() {
+      ++owner_->made_a_;
+    }
+  };
+
+  // KidB is 3 pointers long, so on 64-bit along with the next pointer
+  // we will be using 32 bytes per allocation and it will divide
+  // the block size.
+  //
+  // The difference in size between A and B lets us test mixed combinations of
+  // different sizes.
+  class KidB : public Base {
+   public:
+    explicit KidB(ArenaTest* o) : Base(o) {}
+
+    ~KidB() {
+      ++owner_->destroyed_b_;
+    }
+
+    virtual void Made() {
+      ++owner_->made_b_;
+    }
+
+   private:
+    void* different_size;
+  };
+
+  // Tests a given mixture of allocations of KidA and KidB --
+  // making sure we get sane pointers and delete things.
+  void TestCombo(int num_a, int num_b) {
+    for (int a = 0; a < num_a; ++a) {
+      CheckPtr(new (&arena_) KidA(this));
+    }
+
+    for (int b = 0; b < num_b; ++b) {
+      CheckPtr(new (&arena_) KidB(this));
+    }
+
+    arena_.DestroyObjects();
+
+    EXPECT_EQ(num_a, made_a_);
+    EXPECT_EQ(num_b, made_b_);
+    EXPECT_EQ(num_a, destroyed_a_);
+    EXPECT_EQ(num_b, destroyed_b_);
+  }
+
+  // Checks to make sure the pointer is sane, and calls Made on it.
+  void CheckPtr(Base* p) {
+    EXPECT_TRUE(seen_ptrs_.find(p) == seen_ptrs_.end());
+    seen_ptrs_.insert(p);
+    p->Made();
+  }
+
+  void ClearStats() {
+    made_a_ = 0;
+    made_b_ = 0;
+    destroyed_a_ = 0;
+    destroyed_b_ = 0;
+    seen_ptrs_.clear();
+  }
+
+  int made_a_;
+  int made_b_;
+  int destroyed_a_;
+  int destroyed_b_;
+  Arena<Base> arena_;
+  std::set<void*> seen_ptrs_;
+};
+
+// Empty arena should be OK without a Destroy
+TEST_F(ArenaTest, TestEmpty) {
+}
+
+// calling Destroy on empty is fine.
+TEST_F(ArenaTest, TestEmptyDestroy) {
+  arena_.DestroyObjects();
+}
+
+TEST_F(ArenaTest, TestJustA) {
+  TestCombo(10000, 0);
+}
+
+TEST_F(ArenaTest, TestJustA2) {
+  // On 32-bit this should perfectly fill all the blocks it uses
+  TestCombo(2048, 0);
+}
+
+TEST_F(ArenaTest, TestJustB) {
+  TestCombo(0, 10000);
+}
+
+TEST_F(ArenaTest, TestJustB2) {
+  // On 64-bit this should perfectly fill all the blocks it uses
+  TestCombo(0, 2048);
+}
+
+TEST_F(ArenaTest, TestMix) {
+  TestCombo(10000, 20000);
+}
+
+// Make sure we work again after a clear
+TEST_F(ArenaTest, TestReuse) {
+  TestCombo(10000, 20000);
+  ClearStats();
+  TestCombo(20000, 10000);
+}
+
+// Tests for alignment helper.
+TEST_F(ArenaTest, TestAlign) {
+  // A few that work regardless of arch, to sanity-check
+  // the more through loop below
+  EXPECT_EQ(8, arena_.ExpandToAlign(8));
+  EXPECT_EQ(16, arena_.ExpandToAlign(15));
+  EXPECT_EQ(16, arena_.ExpandToAlign(14));
+  EXPECT_EQ(16, arena_.ExpandToAlign(13));
+
+  for (size_t t = 0; t < 1000u; ++t) {
+    size_t expanded = arena_.ExpandToAlign(t);
+    if ((t % arena_.kAlign) == 0) {
+      // Well-aligned case.
+      EXPECT_EQ(t, expanded);
+    } else {
+      // Otherwise should be next multiple
+      EXPECT_EQ(((t / arena_.kAlign) + 1) * arena_.kAlign, expanded);
+    }
+  }
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/atom.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/atom.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/atom.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/atom.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: jmarantz@google.com (Joshua Marantz),
+//         morlovich@google.com (Maksim Orlovich)
+
+#include "net/instaweb/util/public/atom.h"
+
+namespace net_instaweb {
+
+Atom::Atom() : str_("") {
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/base64_test.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/base64_test.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/base64_test.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/base64_test.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: jmarantz@google.com (Joshua Marantz)
+
+// Unit-test the base64 encoder.
+
+#include "net/instaweb/util/public/basictypes.h"
+#include "net/instaweb/util/public/base64_util.h"
+#include "net/instaweb/util/public/gtest.h"
+#include "net/instaweb/util/public/string.h"
+#include "net/instaweb/util/public/string_util.h"
+
+namespace {
+
+const char chinese_data[] = "中华网,中华,中国,中文网,中国新闻,香港新闻,"
+    "国际新闻,中文新闻,新闻,港台新闻,两会,嫦娥一号";
+const int chinese_size = STATIC_STRLEN(chinese_data);
+
+// Also test some binary data, including embedded nulls, 2^7-1, 2^8-1
+const char binary_data[] = "\0\1\2\3\4\5\6\7\10\0\177\176\175\377\376";
+const int binary_size = STATIC_STRLEN(binary_data);
+
+class Codec {
+ public:
+  virtual ~Codec() {}
+  virtual void encode(const GoogleString& in, GoogleString* out) const = 0;
+  virtual bool decode(const GoogleString& in, GoogleString* out) const = 0;
+};
+
+class WebSafeBase64Codec : public Codec {
+ public:
+  virtual void encode(const GoogleString& in, GoogleString* out) const {
+    net_instaweb::Web64Encode(in, out);
+  }
+  virtual bool decode(const GoogleString& in, GoogleString* out) const {
+    return net_instaweb::Web64Decode(in, out);
+  }
+};
+
+class MimeBase64Codec : public Codec {
+ public:
+  virtual void encode(const GoogleString& in, GoogleString* out) const {
+    net_instaweb::Mime64Encode(in, out);
+  }
+  virtual bool decode(const GoogleString& in, GoogleString* out) const {
+    return net_instaweb::Mime64Decode(in, out);
+  }
+};
+
+}  // namespace
+
+namespace net_instaweb {
+
+class Base64Test : public testing::Test {
+ protected:
+  Base64Test()
+      : chinese_(chinese_data, chinese_size),
+        binary_(binary_data, binary_size),
+        web64_codec_(),
+        mime64_codec_() {
+  }
+
+  void TestWeb64(const Codec &codec, const GoogleString& input) {
+    GoogleString encoded, decoded;
+    codec.encode(input, &encoded);
+    ASSERT_TRUE(codec.decode(encoded, &decoded));
+    EXPECT_EQ(input, decoded);
+  }
+
+  // Tests that attempts to decode a string that is not properly base64
+  // encoded will gracefully fail (Web64Decode returns false) rather than
+  // crash or produce invalid output.  corrupt_char must be a character
+  // that is not in the base64 char-set.
+  //
+  // If the 'index' is specified as a negative number, it will be taken
+  // as an offset from the end of the string.
+  void TestCorrupt(const Codec &codec,
+                   const GoogleString& input, char corrupt_char, int index) {
+    GoogleString encoded, decoded;
+    codec.encode(input, &encoded);
+    if (index < 0) {
+      index = encoded.size() + index;
+    }
+    encoded[index] = corrupt_char;
+    ASSERT_FALSE(codec.decode(encoded, &decoded));
+  }
+
+  GoogleString chinese_;
+  GoogleString binary_;
+  WebSafeBase64Codec web64_codec_;
+  MimeBase64Codec mime64_codec_;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(Base64Test);
+};
+
+TEST_F(Base64Test, Chinese) {
+  TestWeb64(web64_codec_, chinese_);
+  TestWeb64(mime64_codec_, chinese_);
+}
+
+TEST_F(Base64Test, Binary) {
+  TestWeb64(web64_codec_, binary_);
+  TestWeb64(mime64_codec_, binary_);
+}
+
+TEST_F(Base64Test, CorruptFirst) {
+  TestCorrupt(web64_codec_, chinese_, '@', 0);
+  TestCorrupt(mime64_codec_, chinese_, '@', 0);
+}
+
+TEST_F(Base64Test, CorruptMiddle) {
+  TestCorrupt(web64_codec_, chinese_, ':', chinese_.size() / 2);
+  TestCorrupt(mime64_codec_, chinese_, ':', chinese_.size() / 2);
+}
+
+TEST_F(Base64Test, CorruptEnd) {
+  // I wanted to put the '/' as the last character, but it turns out
+  // that encoders may put '=' characters in to pad to a multiple of
+  // 4 bytes, and the decoder stops decoding when it gets to the first
+  // pad character, so changing "==" to "=/" has no effect.
+  TestCorrupt(web64_codec_, chinese_, '/', -4);
+  TestCorrupt(mime64_codec_, chinese_, '_', -4);
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/cache_interface.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/cache_interface.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/cache_interface.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/cache_interface.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: jmarantz@google.com (Joshua Marantz)
+
+#include "net/instaweb/util/public/cache_interface.h"
+
+namespace net_instaweb {
+
+CacheInterface::~CacheInterface() {
+}
+
+CacheInterface::Callback::~Callback() {
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/cache_test_base.h
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/cache_test_base.h?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/cache_test_base.h (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/cache_test_base.h Thu May  1 11:43:36 2014
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: jmarantz@google.com (Joshua Marantz)
+
+// Shared infrastructure for testing cache implementations
+
+#ifndef NET_INSTAWEB_UTIL_CACHE_TEST_BASE_H_
+#define NET_INSTAWEB_UTIL_CACHE_TEST_BASE_H_
+
+#include "net/instaweb/util/public/cache_interface.h"
+
+#include "net/instaweb/util/public/basictypes.h"
+#include "net/instaweb/util/public/gtest.h"
+#include "net/instaweb/util/public/shared_string.h"
+#include "net/instaweb/util/public/string.h"
+
+namespace net_instaweb {
+
+class CacheTestBase : public testing::Test {
+ public:
+  // Helper class for calling Get on cache implementations
+  // that are blocking in nature (e.g. in-memory LRU or blocking file-system).
+  class Callback : public CacheInterface::Callback {
+   public:
+    Callback() { Reset(); }
+    virtual ~Callback() {}
+    Callback* Reset() {
+      called_ = false;
+      state_ = CacheInterface::kNotFound;
+      SharedString empty;
+      *value() = empty;
+      return this;
+    }
+    virtual void Done(CacheInterface::KeyState state) {
+      called_ = true;
+      state_ = state;
+    }
+
+    bool called_;
+    CacheInterface::KeyState state_;
+
+   private:
+    DISALLOW_COPY_AND_ASSIGN(Callback);
+  };
+
+  void CheckGet(const char* key, const GoogleString& expected_value) {
+    CheckGet(Cache(), key, expected_value);
+  }
+
+  void CheckGet(CacheInterface* cache, const char* key,
+                const GoogleString& expected_value) {
+    cache->Get(key, callback_.Reset());
+    ASSERT_TRUE(callback_.called_);
+    ASSERT_EQ(CacheInterface::kAvailable, callback_.state_)
+        << "For key: " << key;
+    EXPECT_EQ(expected_value, **callback_.value()) << "For key: " << key;
+    SanityCheck();
+  }
+
+  void CheckPut(const char* key, const char* value) {
+    CheckPut(Cache(), key, value);
+  }
+
+  void CheckPut(CacheInterface* cache, const char* key, const char* value) {
+    SharedString put_buffer(value);
+    cache->Put(key, &put_buffer);
+    SanityCheck();
+  }
+
+  void CheckNotFound(const char* key) {
+    CheckNotFound(Cache(), key);
+  }
+
+  void CheckNotFound(CacheInterface* cache, const char* key) {
+    cache->Get(key, callback_.Reset());
+    ASSERT_TRUE(callback_.called_);
+    EXPECT_NE(CacheInterface::kAvailable, callback_.state_)
+        << "For key: " << key;
+    SanityCheck();
+  }
+
+ protected:
+  virtual CacheInterface* Cache() = 0;
+  virtual void SanityCheck() {
+  }
+
+  // Returns a read-only view of the callback for helping determine whether
+  // it was called, and with what state.
+  const Callback& callback() const { return callback_; }
+
+  // Clears out the callback to its initial state so it can be
+  // passed into a CacheInterface method.
+  Callback* ResetCallback() {
+    callback_.Reset();
+    return &callback_;
+  }
+
+ private:
+  Callback callback_;
+};
+
+}  // namespace net_instaweb
+
+#endif  // NET_INSTAWEB_UTIL_CACHE_TEST_BASE_H_

Propchange: httpd/mod_spdy/trunk/net/instaweb/util/cache_test_base.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: httpd/mod_spdy/trunk/net/instaweb/util/checking_thread_system.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/checking_thread_system.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/checking_thread_system.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/checking_thread_system.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: jmaessen@google.com (Jan-Willem Maessen)
+
+#include "net/instaweb/util/public/checking_thread_system.h"
+
+#include "base/logging.h"
+#include "net/instaweb/util/public/atomic_bool.h"
+#include "net/instaweb/util/public/basictypes.h"
+#include "net/instaweb/util/public/condvar.h"
+#include "net/instaweb/util/public/thread_system.h"
+
+namespace net_instaweb {
+
+// Checked condvar class.  Must only be created via a
+// CheckingThreadSystem::Mutex, thus its implementation is kept private.
+class CheckingThreadSystem::CheckingCondvar : public ThreadSystem::Condvar {
+ public:
+  CheckingCondvar(CheckingThreadSystem::Mutex* mutex,
+          ThreadSystem::Condvar* condvar)
+      : mutex_(mutex), condvar_(condvar) { }
+  virtual ~CheckingCondvar() { }
+  virtual CheckingThreadSystem::Mutex* mutex() const {
+    return mutex_;
+  }
+  virtual void Signal() {
+    condvar_->Signal();
+  }
+  virtual void Broadcast() {
+    condvar_->Broadcast();
+  }
+  virtual void Wait() {
+    mutex_->DropLockControl();
+    condvar_->Wait();
+    mutex_->TakeLockControl();
+  }
+  virtual void TimedWait(int64 timeout_ms) {
+    mutex_->DropLockControl();
+    condvar_->TimedWait(timeout_ms);
+    mutex_->TakeLockControl();
+  }
+ private:
+  CheckingThreadSystem::Mutex* mutex_;
+  scoped_ptr<ThreadSystem::Condvar> condvar_;
+  DISALLOW_COPY_AND_ASSIGN(CheckingCondvar);
+};
+
+// Destructor and methods for CheckingThreadSystem::Mutex
+
+CheckingThreadSystem::Mutex::~Mutex() {
+  CHECK(!locked_.value()) << "Lock should not be held on destruction.";
+}
+
+void CheckingThreadSystem::Mutex::DCheckLocked() {
+  CHECK(locked_.value()) << "Lock should have been held.";
+}
+
+void CheckingThreadSystem::Mutex::DropLockControl() {
+  DCheckLocked();
+  locked_.set_value(false);
+}
+
+void CheckingThreadSystem::Mutex::TakeLockControl() {
+  CHECK(!locked_.value()) << "Lock should have been available.";
+  locked_.set_value(true);
+}
+
+void CheckingThreadSystem::Mutex::Lock() {
+  mutex_->Lock();
+  TakeLockControl();
+}
+
+void CheckingThreadSystem::Mutex::Unlock() {
+  DropLockControl();
+  mutex_->Unlock();
+}
+
+ThreadSystem::Condvar* CheckingThreadSystem::Mutex::NewCondvar() {
+  ThreadSystem::Condvar* enclosed = mutex_->NewCondvar();
+  return new CheckingThreadSystem::CheckingCondvar(this, enclosed);
+}
+
+// Destructor and methods for CheckingThreadSystem::RWLock
+
+CheckingThreadSystem::RWLock::~RWLock() {
+  CHECK_EQ(locked_.value(), 0) << "Lock should not be held on destruction.";
+}
+
+void CheckingThreadSystem::RWLock::DCheckLocked() {
+  CHECK_EQ(locked_.value(), -1) << "Lock should have been held.";
+}
+
+void CheckingThreadSystem::RWLock::DCheckReaderLocked() {
+  CHECK_GT(locked_.value(), 0) << "Lock should have been held.";
+}
+
+void CheckingThreadSystem::RWLock::DropLockControl() {
+  DCheckLocked();
+  locked_.set_value(0);
+}
+
+void CheckingThreadSystem::RWLock::TakeLockControl() {
+  CHECK_EQ(locked_.value(), 0) << "Lock should have been available.";
+  locked_.set_value(-1);
+}
+
+void CheckingThreadSystem::RWLock::DropReaderLockControl() {
+  DCheckReaderLocked();
+  locked_.increment(-1);
+}
+
+void CheckingThreadSystem::RWLock::TakeReaderLockControl() {
+  CHECK_GE(locked_.value(), 0) << "Lock should have been available.";
+  locked_.increment(1);
+}
+
+void CheckingThreadSystem::RWLock::Lock() {
+  lock_->Lock();
+  TakeLockControl();
+}
+
+void CheckingThreadSystem::RWLock::Unlock() {
+  DropLockControl();
+  lock_->Unlock();
+}
+
+void CheckingThreadSystem::RWLock::ReaderLock() {
+  lock_->ReaderLock();
+  TakeReaderLockControl();
+}
+
+void CheckingThreadSystem::RWLock::ReaderUnlock() {
+  DropReaderLockControl();
+  lock_->ReaderUnlock();
+}
+
+// Destructor and methods for CheckingThreadSystem
+
+CheckingThreadSystem::~CheckingThreadSystem() { }
+
+CheckingThreadSystem::Mutex* CheckingThreadSystem::NewMutex() {
+  return new Mutex(thread_system_->NewMutex());
+}
+
+CheckingThreadSystem::RWLock* CheckingThreadSystem::NewRWLock() {
+  return new RWLock(thread_system_->NewRWLock());
+}
+
+ThreadSystem::ThreadImpl* CheckingThreadSystem::NewThreadImpl(
+    ThreadSystem::Thread* wrapper, ThreadSystem::ThreadFlags flags) {
+  return thread_system_->NewThreadImpl(wrapper, flags);
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/chunking_writer.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/chunking_writer.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/chunking_writer.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/chunking_writer.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: morlovich@google.com (Maksim Orlovich)
+
+#include "net/instaweb/util/public/chunking_writer.h"
+
+#include <algorithm>
+#include <cstddef>
+#include "net/instaweb/util/public/string_util.h"
+#include "net/instaweb/util/public/writer.h"
+
+namespace net_instaweb {
+
+class MessageHandler;
+
+ChunkingWriter::ChunkingWriter(Writer* writer, int flush_limit)
+    : writer_(writer), flush_limit_(flush_limit), unflushed_bytes_(0) {
+}
+
+ChunkingWriter::~ChunkingWriter() {
+}
+
+bool ChunkingWriter::Write(const StringPiece& str_orig,
+                           MessageHandler* handler) {
+  StringPiece str = str_orig;
+
+  // ensure we have some output allowance
+  if (!FlushIfNeeded(handler)) {
+    return false;
+  }
+
+  while (!str.empty()) {
+    size_t to_write = str.size();
+    if (flush_limit_ > 0) {
+      // Figure out how many bytes we can write without going over
+      // the flush window limit. flush_limit_ - unflushed_bytes_ is positive
+      // since this is always preceeded by a FlushIfNeeded()
+      to_write = std::min(static_cast<int>(str.size()),
+                          flush_limit_ - unflushed_bytes_);
+    }
+
+    if (!writer_->Write(StringPiece(str.data(), to_write), handler)) {
+      return false;
+    }
+
+    str.remove_prefix(to_write);
+    unflushed_bytes_ += to_write;
+    if (!FlushIfNeeded(handler)) {
+      return false;
+    }
+  }
+  return true;
+}
+
+bool ChunkingWriter::Flush(MessageHandler* handler) {
+  unflushed_bytes_ = 0;
+  return writer_->Flush(handler);
+}
+
+bool ChunkingWriter::FlushIfNeeded(MessageHandler* handler) {
+  if (flush_limit_ <= 0 || unflushed_bytes_ < flush_limit_) {
+    return true;
+  }
+
+  return Flush(handler);
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/chunking_writer_test.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/chunking_writer_test.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/chunking_writer_test.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/chunking_writer_test.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: morlovich@google.com (Maksim Orlovich)
+
+#include "net/instaweb/util/public/chunking_writer.h"
+
+#include "base/scoped_ptr.h"
+#include "net/instaweb/util/public/gtest.h"
+#include "net/instaweb/util/public/mock_message_handler.h"
+#include "net/instaweb/util/public/string.h"
+#include "net/instaweb/util/public/string_util.h"
+#include "net/instaweb/util/public/writer.h"
+
+namespace net_instaweb {
+class MessageHandler;
+
+namespace {
+
+// Records a traces of writes and flushes performed into recorded()
+// as follows:
+// 1) Write of "text" will append: W:text|
+// 2) A flush will append: F|
+//
+// Also makes sure the passed in handler is correct, and let's one
+// trigger failures on a given operation.
+class TracingWriter : public Writer {
+ public:
+  explicit TracingWriter(MessageHandler* expected_handler) :
+      expected_handler_(expected_handler), ops_(0), fail_on_op_(-1) {
+  }
+
+  virtual bool Write(const StringPiece& str, MessageHandler* handler) {
+    EXPECT_EQ(expected_handler_, handler);
+    if (ops_ == fail_on_op_) {
+      // Still advance, so that we know we don't get called again
+      ++ops_;
+      return false;
+    }
+    ++ops_;
+
+    recorded_.append("W:");
+    recorded_.append(str.data(), str.size());
+    recorded_.append("|");
+    return true;
+  }
+
+  virtual bool Flush(MessageHandler* handler) {
+    EXPECT_EQ(expected_handler_, handler);
+    if (ops_ == fail_on_op_) {
+      // Still advance, so that we know we don't get called again
+      ++ops_;
+      return false;
+    }
+    ++ops_;
+
+    recorded_.append("F|");
+    return true;
+  }
+
+  const GoogleString& recorded() const { return recorded_; }
+
+  // Tells this filter to report a failure on n'th invocation exactly.
+  // (starting from 0)
+  void set_fail_on_op(int n) { fail_on_op_ = n; }
+
+ private:
+  MessageHandler* expected_handler_;
+  GoogleString recorded_;
+  int ops_;
+  int fail_on_op_;
+};
+
+
+class ChunkingWriterTest : public testing::Test {
+ public:
+  virtual void SetUp() {
+    tracer_.reset(new TracingWriter(&message_handler_));
+    SetUpWithLimit(0);
+  }
+
+  void SetUpWithLimit(int limit) {
+    chunker_.reset(new ChunkingWriter(tracer_.get(), limit));
+  }
+
+ protected:
+  MockMessageHandler message_handler_;
+  scoped_ptr<TracingWriter> tracer_;
+  scoped_ptr<ChunkingWriter> chunker_;
+};
+
+TEST_F(ChunkingWriterTest, UnchunkedBasic) {
+  EXPECT_TRUE(chunker_->Write("abc", &message_handler_));
+  EXPECT_TRUE(chunker_->Write("def", &message_handler_));
+  EXPECT_TRUE(chunker_->Flush(&message_handler_));
+  EXPECT_EQ("W:abc|W:def|F|", tracer_->recorded());
+}
+
+TEST_F(ChunkingWriterTest, ChunkedBasic) {
+  SetUpWithLimit(2);
+  EXPECT_TRUE(chunker_->Write("abc", &message_handler_));
+  EXPECT_TRUE(chunker_->Write("def", &message_handler_));
+  EXPECT_TRUE(chunker_->Flush(&message_handler_));
+  EXPECT_EQ("W:ab|F|W:c|W:d|F|W:ef|F|F|", tracer_->recorded());
+}
+
+TEST_F(ChunkingWriterTest, ChunkedBasicLong) {
+  SetUpWithLimit(4);
+  EXPECT_TRUE(chunker_->Write("abcdefghijklmnopqrs", &message_handler_));
+  EXPECT_TRUE(chunker_->Flush(&message_handler_));
+  EXPECT_EQ("W:abcd|F|W:efgh|F|W:ijkl|F|W:mnop|F|W:qrs|F|",
+            tracer_->recorded());
+}
+
+TEST_F(ChunkingWriterTest, ChunkedManualFlush) {
+  SetUpWithLimit(4);
+  EXPECT_TRUE(chunker_->Write("abc", &message_handler_));
+  EXPECT_TRUE(chunker_->Flush(&message_handler_));
+  EXPECT_TRUE(chunker_->Write("defgh", &message_handler_));
+  EXPECT_EQ("W:abc|F|W:defg|F|W:h|", tracer_->recorded());
+}
+
+TEST_F(ChunkingWriterTest, UnchunkedFailureProp1) {
+  tracer_->set_fail_on_op(1);
+  EXPECT_TRUE(chunker_->Write("abc", &message_handler_));
+  EXPECT_FALSE(chunker_->Write("def", &message_handler_));
+  EXPECT_EQ("W:abc|", tracer_->recorded());
+}
+
+TEST_F(ChunkingWriterTest, UnchunkedFailureProp2) {
+  tracer_->set_fail_on_op(2);
+  EXPECT_TRUE(chunker_->Write("abc", &message_handler_));
+  EXPECT_TRUE(chunker_->Write("def", &message_handler_));
+  EXPECT_FALSE(chunker_->Flush(&message_handler_));
+  EXPECT_EQ("W:abc|W:def|", tracer_->recorded());
+}
+
+TEST_F(ChunkingWriterTest, ChunkedFailureProp1) {
+  tracer_->set_fail_on_op(1);
+  SetUpWithLimit(4);
+  EXPECT_FALSE(chunker_->Write("abcdefgh", &message_handler_));
+  EXPECT_EQ("W:abcd|", tracer_->recorded());
+}
+
+TEST_F(ChunkingWriterTest, ChunkedFailureProp2) {
+  tracer_->set_fail_on_op(2);
+  SetUpWithLimit(4);
+  EXPECT_FALSE(chunker_->Write("abcdefgh", &message_handler_));
+  EXPECT_EQ("W:abcd|F|", tracer_->recorded());
+}
+
+TEST_F(ChunkingWriterTest, ChunkedFailureProp3) {
+  tracer_->set_fail_on_op(3);
+  SetUpWithLimit(4);
+  EXPECT_FALSE(chunker_->Write("abcdefgh", &message_handler_));
+  EXPECT_EQ("W:abcd|F|W:efgh|", tracer_->recorded());
+}
+
+TEST_F(ChunkingWriterTest, ChunkedFailureProp4) {
+  tracer_->set_fail_on_op(4);
+  SetUpWithLimit(4);
+  EXPECT_TRUE(chunker_->Write("abcdefgh", &message_handler_));
+  EXPECT_EQ("W:abcd|F|W:efgh|F|", tracer_->recorded());
+}
+
+}  // namespace
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/circular_buffer.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/circular_buffer.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/circular_buffer.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/circular_buffer.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: fangfei@google.com (Fangfei Zhou)
+
+#include <cstdlib>         // for malloc
+#include <algorithm>       // for min
+#include "base/logging.h"  // for DCHECK
+#include "net/instaweb/util/public/circular_buffer.h"
+#include "net/instaweb/util/public/string.h"
+#include "net/instaweb/util/public/string_writer.h"
+#include "net/instaweb/util/public/string_util.h"
+
+namespace net_instaweb {
+
+class MessageHandler;
+
+CircularBuffer* CircularBuffer::Create(const int capacity) {
+  int total = Sizeof(capacity);
+  CircularBuffer* cb = static_cast<CircularBuffer*>(malloc(total));
+  cb->capacity_ = capacity;
+  cb->wrapped_ = false;
+  cb->offset_ = 0;
+  return cb;
+}
+
+CircularBuffer* CircularBuffer::Init(bool parent, void* block,
+                                     const int block_size,
+                                     const int capacity) {
+  // Check if the pre-allocated block has right size for CircularBuffer.
+  DCHECK(block_size == Sizeof(capacity));
+  CircularBuffer* cb = static_cast<CircularBuffer*>(block);
+  if (parent) {
+    // In root process, initialize the variables.
+    cb->capacity_ = capacity;
+    cb->wrapped_ = false;
+    cb->offset_ = 0;
+  }
+  return cb;
+}
+
+void CircularBuffer::Clear() {
+  offset_ = 0;
+  wrapped_ = false;
+}
+
+bool CircularBuffer::Write(const StringPiece& message) {
+  const char* data = message.data();
+  int size = message.size();
+  // Left-truncate the message if its size is larger than buffer.
+  if (size > capacity_) {
+    data += size - capacity_;
+    size = capacity_;
+    memcpy(buffer_, data, size);
+    offset_ = 0;
+    wrapped_ = true;
+    return true;
+  }
+  // Otherwise, start to write the message at offset.
+  if (offset_ == capacity_) {
+    offset_ = 0;
+    wrapped_ = true;
+  }
+  int rest = capacity_ - offset_;
+  int len = std::min(rest, size);
+  memcpy(buffer_ + offset_, data, len);
+  offset_ += len;
+  // If available size < message size < buffer capacity,
+  // write the rest of the data at the beginning of the buffer.
+  if (len < size) {
+    memcpy(buffer_, data + len, size - len);
+    offset_ = size - len;
+    wrapped_ = true;
+  }
+  return true;
+}
+
+GoogleString CircularBuffer::ToString(MessageHandler* handler) {
+  GoogleString result;
+  StringWriter writer(&result);
+  writer.Write(FirstChunk(), handler);
+  writer.Write(SecondChunk(), handler);
+  return result;
+}
+
+StringPiece CircularBuffer::FirstChunk() {
+  if (!wrapped_) {
+    return StringPiece();
+  }
+  return StringPiece(buffer_ + offset_, capacity_ - offset_);
+}
+
+StringPiece CircularBuffer::SecondChunk() {
+  return StringPiece(buffer_, offset_);
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/circular_buffer_test.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/circular_buffer_test.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/circular_buffer_test.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/circular_buffer_test.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,109 @@
+// Copyright 2011 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Author: fangfei@google.com (Fangfei Zhou)
+
+#include <cstdlib>
+#include "net/instaweb/util/public/circular_buffer.h"
+#include "net/instaweb/util/public/mock_message_handler.h"
+#include "net/instaweb/util/public/gtest.h"
+
+namespace net_instaweb {
+
+class CircularBufferTest : public testing::Test {
+ protected:
+  MockMessageHandler handler_;
+};
+
+// Instantiate CircularBuffer with malloc.
+TEST_F(CircularBufferTest, InstantiateWithMalloc) {
+  CircularBuffer* cb = CircularBuffer::Create(10);
+  cb->Write("012345");
+  EXPECT_EQ("012345", cb->ToString(&handler_));
+  free(cb);
+}
+
+// Instantiate CircularBuffer with pre-allocated block of right size.
+TEST_F(CircularBufferTest, InstantiateWithPreAllocatedBlock) {
+  const int capacity = 10;
+  const int segment_size = CircularBuffer::Sizeof(capacity);
+  void* segment = static_cast<void*>(malloc(segment_size));
+  CircularBuffer* cb = CircularBuffer::Init(true, segment,
+                                            segment_size, capacity);
+  if (cb != NULL) {
+    cb->Write("0123456789");
+  }
+  EXPECT_EQ("0123456789", cb->ToString(&handler_));
+  free(segment);
+}
+
+// Test circular buffer overwritten result.
+TEST_F(CircularBufferTest, CircularWritten) {
+  const int capacity = 10;
+  CircularBuffer* cb = CircularBuffer::Create(capacity);
+  cb->Write("012345");
+  EXPECT_EQ("012345", cb->ToString(&handler_));
+  cb->Write("67");
+  EXPECT_EQ("01234567", cb->ToString(&handler_));
+  // Buffer size is 10, it should be filled exactly so far.
+  cb->Write("89");
+  EXPECT_EQ("0123456789", cb->ToString(&handler_));
+  // Lose the first char.
+  cb->Write("a");
+  EXPECT_EQ("123456789a", cb->ToString(&handler_));
+  // Message size is larger than buffer size.
+  cb->Write("bcdefghijkl");
+  EXPECT_EQ("cdefghijkl", cb->ToString(&handler_));
+  free(cb);
+}
+
+// Test the content after clear().
+TEST_F(CircularBufferTest, OverWrittenAfterClear) {
+  const int capacity = 10;
+  CircularBuffer* cb = CircularBuffer::Create(capacity);
+  cb->Write("0123456789");
+  EXPECT_EQ("0123456789", cb->ToString(&handler_));
+  cb->Clear();
+  cb->Write("abc");
+  EXPECT_EQ("abc", cb->ToString(&handler_));
+  free(cb);
+}
+
+// Test corner case where buffer size is 1.
+TEST_F(CircularBufferTest, SmallSize) {
+  // CircularBuffer instantiated with malloc.
+  const int capacity = 1;
+  CircularBuffer* cb = CircularBuffer::Create(capacity);
+  cb->Write("0");
+  EXPECT_EQ("0", cb->ToString(&handler_));
+  cb->Write("1");
+  EXPECT_EQ("1", cb->ToString(&handler_));
+  cb->Write("234");
+  EXPECT_EQ("4", cb->ToString(&handler_));
+  free(cb);
+  // CircularBuffer instantiated with pre-allocated buffer.
+  int segment_size = CircularBuffer::Sizeof(capacity);
+  void* segment = static_cast<void*>(malloc(segment_size));
+  CircularBuffer* temp = CircularBuffer::Init(true, segment,
+                                              segment_size, capacity);
+  temp->Write("0");
+  EXPECT_EQ("0", temp->ToString(&handler_));
+  temp->Write("1");
+  EXPECT_EQ("1", temp->ToString(&handler_));
+  temp->Write("234");
+  EXPECT_EQ("4", temp->ToString(&handler_));
+  free(temp);
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/condvar.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/condvar.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/condvar.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/condvar.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,25 @@
+// Copyright 2011 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Author: jmaessen@google.com (Jan Maessen)
+
+#include "net/instaweb/util/public/condvar.h"
+
+#include "net/instaweb/util/public/thread_system.h"
+
+namespace net_instaweb {
+
+ThreadSystem::Condvar::~Condvar() { }
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/counting_writer.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/counting_writer.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/counting_writer.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/counting_writer.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: jmarantz@google.com (Joshua Marantz)
+
+#include "net/instaweb/util/public/counting_writer.h"
+#include "net/instaweb/util/public/writer.h"
+#include "net/instaweb/util/public/string_util.h"
+
+namespace net_instaweb {
+class MessageHandler;
+
+CountingWriter::~CountingWriter() {
+}
+
+bool CountingWriter::Write(const StringPiece& str, MessageHandler* handler) {
+  byte_count_ += str.size();
+  return writer_->Write(str, handler);
+}
+
+bool CountingWriter::Flush(MessageHandler* handler) {
+  return writer_->Flush(handler);
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/data_url.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/data_url.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/data_url.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/data_url.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: jmaessen@google.com (Jan Maessen)
+
+#include "net/instaweb/util/public/data_url.h"
+
+#include <cstddef>
+#include "net/instaweb/http/public/content_type.h"
+#include "net/instaweb/util/public/base64_util.h"
+#include "net/instaweb/util/public/string.h"
+#include "net/instaweb/util/public/string_util.h"
+
+namespace net_instaweb {
+
+void DataUrl(const ContentType& content_type,
+             const Encoding encoding,
+             const StringPiece& content,
+             GoogleString* result) {
+  result->assign("data:");
+  result->append(content_type.mime_type());
+  switch (encoding) {
+    case BASE64: {
+      result->append(";base64,");
+      GoogleString encoded;
+      Mime64Encode(content, &encoded);
+      result->append(encoded);
+      break;
+    }
+// TODO(jmaessen): Figure out if we ever need non-BASE64 encodings,
+// and if so actually write them.  Here are the stubs.
+//     case UTF8:
+//       result->append(";charset=\"utf-8\",");
+//       // TODO(jmaessen): find %-encoding code to use here.
+//       //   jmarantz has one pending.
+//       result.append(content);
+//     case LATIN1:
+//       result->append(";charset=\"\",");
+//       // TODO(jmaessen): find %-encoding code to use here.
+//       //   Not the UTF-8 one!
+    default: {
+      // either UNKNOWN or PLAIN.  No special encoding or alphabet.  We're in a
+      // context where we don't want to fail, so we try to give sensible output
+      // if encoding is actually out of range; this gives some hope of graceful
+      // degradation of experience.
+      result->append(",");
+      content.AppendToString(result);
+      break;
+    }
+  }
+}
+
+bool ParseDataUrl(const StringPiece& url,
+                  const ContentType** content_type,
+                  Encoding* encoding,
+                  StringPiece* encoded_content) {
+  const char kData[] = "data:";
+  const size_t kDataSize = STATIC_STRLEN(kData);
+  const char kBase64[] = ";base64";
+  const size_t kBase64Size = STATIC_STRLEN(kBase64);
+  // First invalidate all outputs.
+  *content_type = NULL;
+  *encoding = UNKNOWN;
+  encoded_content->clear();
+  size_t header_boundary = url.find(',');
+  if (header_boundary == url.npos || !url.starts_with(kData)) {
+    return false;
+  }
+  StringPiece header(url.data(), header_boundary);
+  size_t mime_boundary = header.find(';');
+  if (mime_boundary == url.npos) {
+    // no charset or base64 encoding.
+    mime_boundary = header_boundary;
+    *encoding = PLAIN;
+  } else if (header_boundary >= mime_boundary + kBase64Size) {
+    if (header.ends_with(kBase64)) {
+      *encoding = BASE64;
+    } else {
+      *encoding = PLAIN;
+    }
+  }
+  StringPiece mime_type(url.data() + kDataSize, mime_boundary - kDataSize);
+  *content_type = MimeTypeToContentType(mime_type);
+  encoded_content->set(url.data() + header_boundary + 1,
+                       url.size() - header_boundary - 1);
+  return true;
+}
+
+bool DecodeDataUrlContent(Encoding encoding,
+                          const StringPiece& encoded_content,
+                          GoogleString* decoded_content) {
+  switch (encoding) {
+    case PLAIN:
+      // No change, just copy data.
+      encoded_content.CopyToString(decoded_content);
+      return true;
+    case BASE64:
+      return Mime64Decode(encoded_content, decoded_content);
+    default:
+      return false;
+  }
+}
+
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/data_url_test.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/data_url_test.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/data_url_test.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/data_url_test.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: jmaessen@google.com (Jan Maessen)
+
+#include "net/instaweb/util/public/data_url.h"
+
+#include "net/instaweb/http/public/content_type.h"
+#include "net/instaweb/util/public/basictypes.h"
+#include "net/instaweb/util/public/string.h"
+#include "net/instaweb/util/public/string_util.h"
+#include "net/instaweb/util/public/gtest.h"
+
+namespace net_instaweb {
+namespace {
+
+const GoogleString kAsciiData =
+    "A_Rather=Long,But-conventional?looking_string#with;some:odd,characters.";
+const GoogleString kAsciiDataBase64 =
+    "QV9SYXRoZXI9TG9uZyxCdXQtY29udmVudGlvbmFsP2xvb2tpbmdfc3RyaW5nI3dpdGg7c29"
+    "tZTpvZGQsY2hhcmFjdGVycy4=";
+
+// A string with embedded NULs; we must construct it carefully to avoid
+// truncation.
+const char kMixedDataChars[] =
+    "This string\ncontains\0lots of\tunusual\xe3~characters\xd7\xa5";
+const char kMixedDataBase64[] =
+    "VGhpcyBzdHJpbmcKY29udGFpbnMAbG90cyBvZgl1bnVzdWFs435jaGFyYWN0ZXJz16U=";
+
+const char kPlainPrefix[] = "data:text/plain,";
+const char kBase64Prefix[] = "data:text/plain;base64,";
+
+const char kGifPlainPrefix[] = "data:image/gif,";
+const char kGifBase64Prefix[] = "data:image/gif;base64,";
+
+class DataUrlTest : public testing::Test {
+ public:
+  DataUrlTest()
+      : mixed_data_(kMixedDataChars, STATIC_STRLEN(kMixedDataChars)) { }
+
+ protected:
+  // Make a ContentType yield readable failure output.  Needed this to fix bugs
+  // in the tests!  (No actual program bugs found here...)
+  const char* Mime(const ContentType* type) {
+    if (type == NULL || type->mime_type() == NULL) {
+      return "NULL";
+    } else {
+      return type->mime_type();
+    }
+  }
+
+  void TestDecoding(const bool can_parse,
+                    const bool can_decode,
+                    const GoogleString& prefix,
+                    const GoogleString& encoded,
+                    const ContentType* type,
+                    Encoding encoding,
+                    const GoogleString& decoded) {
+    GoogleString url = prefix + encoded;
+    const ContentType* parsed_type;
+    Encoding parsed_encoding = UNKNOWN;
+    StringPiece parsed_encoded;
+    EXPECT_EQ(can_parse,
+              ParseDataUrl(url, &parsed_type,
+                           &parsed_encoding, &parsed_encoded));
+    EXPECT_EQ(encoding, parsed_encoding);
+    EXPECT_EQ(type, parsed_type) << "type '" << Mime(type) <<
+        "' didn't match '" << Mime(parsed_type) << "'\n";
+    EXPECT_EQ(encoded, parsed_encoded);
+    GoogleString parsed_decoded;
+    EXPECT_EQ(can_decode,
+              DecodeDataUrlContent(encoding, parsed_encoded, &parsed_decoded));
+    EXPECT_EQ(decoded, parsed_decoded);
+  }
+
+  GoogleString mixed_data_;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(DataUrlTest);
+};
+
+TEST_F(DataUrlTest, TestDataPlain) {
+  GoogleString url;
+  DataUrl(kContentTypeText, PLAIN, kAsciiData, &url);
+  EXPECT_EQ(kPlainPrefix + kAsciiData, url);
+}
+
+TEST_F(DataUrlTest, TestDataBase64) {
+  GoogleString url;
+  DataUrl(kContentTypeText, BASE64, kAsciiData, &url);
+  EXPECT_EQ(kBase64Prefix + kAsciiDataBase64, url);
+}
+
+TEST_F(DataUrlTest, TestData1Plain) {
+  GoogleString url;
+  DataUrl(kContentTypeGif, PLAIN, mixed_data_, &url);
+  EXPECT_EQ(kGifPlainPrefix + mixed_data_, url);
+}
+
+TEST_F(DataUrlTest, TestData1Base64) {
+  GoogleString url;
+  DataUrl(kContentTypeGif, BASE64, mixed_data_, &url);
+  EXPECT_EQ(StrCat(kGifBase64Prefix, kMixedDataBase64), url);
+}
+
+TEST_F(DataUrlTest, ParseDataPlain) {
+  TestDecoding(true, true, kPlainPrefix, kAsciiData,
+               &kContentTypeText, PLAIN, kAsciiData);
+}
+
+TEST_F(DataUrlTest, ParseDataBase64) {
+  TestDecoding(true, true, kBase64Prefix, kAsciiDataBase64,
+               &kContentTypeText, BASE64, kAsciiData);
+}
+
+TEST_F(DataUrlTest, ParseData1Plain) {
+  TestDecoding(true, true, kPlainPrefix, mixed_data_,
+               &kContentTypeText, PLAIN, mixed_data_);
+}
+
+TEST_F(DataUrlTest, ParseData1Base64) {
+  TestDecoding(true, true, kBase64Prefix, kMixedDataBase64,
+               &kContentTypeText, BASE64, mixed_data_);
+}
+
+TEST_F(DataUrlTest, ParseBadProtocol) {
+  TestDecoding(false, false, "http://www.google.com/", "",
+               NULL, UNKNOWN, "");
+}
+
+TEST_F(DataUrlTest, ParseNoComma) {
+  TestDecoding(false, false,
+               StrCat("data:text/plain;base64;", kMixedDataBase64), "",
+               NULL, UNKNOWN, "");
+}
+
+TEST_F(DataUrlTest, ParseNoMime) {
+  TestDecoding(true, true, "data:;base64,", kMixedDataBase64,
+               NULL, BASE64, mixed_data_);
+}
+
+TEST_F(DataUrlTest, ParseCorruptMime) {
+  TestDecoding(true, true, "data:#$!;base64,", kMixedDataBase64,
+               NULL, BASE64, mixed_data_);
+}
+
+TEST_F(DataUrlTest, ParseBadEncodingIsPlain) {
+  TestDecoding(true, true, "data:text/plain;mumbledypeg,", mixed_data_,
+               &kContentTypeText, PLAIN, mixed_data_);
+}
+
+TEST_F(DataUrlTest, ParseBadBase64) {
+  TestDecoding(true, false, kBase64Prefix, "@%#$%@#$%^@%%^%*%^&*",
+               &kContentTypeText, BASE64, "");
+}
+
+}  // namespace
+}  // namespace net_instaweb

Added: httpd/mod_spdy/trunk/net/instaweb/util/debug.cc
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/net/instaweb/util/debug.cc?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/net/instaweb/util/debug.cc (added)
+++ httpd/mod_spdy/trunk/net/instaweb/util/debug.cc Thu May  1 11:43:36 2014
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Author: jmaessen@google.com (Jan Maessen)
+
+#include <sstream>
+#include "net/instaweb/util/public/debug.h"
+#include "net/instaweb/util/public/string.h"
+
+namespace net_instaweb {
+
+GoogleString StackTraceString() {
+  base::debug::StackTrace trace;
+  std::ostringstream ostream;
+  trace.OutputToStream(&ostream);
+  return ostream.str();
+}
+
+}  // namespace net_instaweb



Mime
View raw message