summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-07-29 18:22:28 +0100
committerKristian Monsen <kristianm@google.com>2010-08-11 11:34:17 +0100
commit00d26a728db2814620f390b418a7d6325ce5aca6 (patch)
tree1a08a766ac3682d979bba42bb32150b3e6b93fdc
parentb3a45980d5cfbb62c937045255faa29a8ffea9f3 (diff)
downloadexternal_chromium-00d26a728db2814620f390b418a7d6325ce5aca6.zip
external_chromium-00d26a728db2814620f390b418a7d6325ce5aca6.tar.gz
external_chromium-00d26a728db2814620f390b418a7d6325ce5aca6.tar.bz2
Collection of all the changs to external chromium.
Time is running out, I guess we have to submit this and remember to upstream. Rebased to chromium r53293 Change-Id: Ie61ca0433b1eedd90144aee87c5efcd68fdc37ac
-rw-r--r--Android.mk577
-rw-r--r--android/prefix.h14
-rw-r--r--android/testing/gtest/include/gtest/gtest_prod.h3
-rw-r--r--android/testing/platform_test.h3
-rw-r--r--app/sql/connection.cc13
-rw-r--r--app/sql/statement.cc4
-rw-r--r--base/compat_execinfo.h2
-rw-r--r--base/debug_util_posix.cc21
-rw-r--r--base/file_path.h2
-rw-r--r--base/file_util_android.cc162
-rw-r--r--base/file_util_posix.cc5
-rw-r--r--base/hash_tables.h14
-rw-r--r--base/logging.cc5
-rw-r--r--base/message_loop.cc7
-rw-r--r--base/message_loop.h4
-rw-r--r--base/process_util.h3
-rw-r--r--base/stats_table.cc18
-rw-r--r--base/string_util.cc8
-rw-r--r--base/string_util_posix.h1
-rw-r--r--base/sys_info_posix.cc16
-rw-r--r--base/third_party/nspr/prcpucfg.h2
-rw-r--r--base/third_party/nspr/prtime.cc11
-rw-r--r--base/time_posix.cc5
-rw-r--r--base/trace_event.cc22
-rw-r--r--base/trace_event.h2
-rw-r--r--build/build_config.h2
-rw-r--r--chrome/browser/net/sqlite_persistent_cookie_store.cc62
-rw-r--r--net/base/address_list.cc1
-rw-r--r--net/base/bandwidth_metrics.h2
-rw-r--r--net/base/file_stream_posix.cc4
-rw-r--r--net/base/gzip_filter.cc5
-rw-r--r--net/base/host_resolver.cc5
-rw-r--r--net/base/host_resolver_impl.cc17
-rw-r--r--net/base/host_resolver_proc.cc4
-rw-r--r--net/base/https_prober.h1
-rw-r--r--net/base/mime_util.cc6
-rw-r--r--net/base/net_util.cc11
-rw-r--r--net/base/sdch_filter.cc2
-rw-r--r--net/base/sdch_manager.cc8
-rw-r--r--net/base/upload_data_stream.cc2
-rw-r--r--net/base/x509_certificate.cc3
-rw-r--r--net/base/x509_certificate.h5
-rw-r--r--net/base/x509_certificate_openssl.cc64
-rw-r--r--net/disk_cache/backend_impl.cc4
-rw-r--r--net/disk_cache/file_posix.cc5
-rw-r--r--net/disk_cache/mem_backend_impl.cc5
-rw-r--r--net/flip/flip_framer.cc8
-rw-r--r--net/flip/flip_network_transaction.cc3
-rw-r--r--net/flip/flip_session.cc24
-rwxr-xr-xnet/flip/flip_stream.cc2
-rw-r--r--net/http/des.cc8
-rw-r--r--net/http/http_cache_transaction.cc2
-rw-r--r--net/http/http_network_transaction.cc4
-rw-r--r--net/proxy/proxy_config_service_linux.h2
-rw-r--r--net/proxy/proxy_service.cc2
-rw-r--r--net/socket/client_socket_factory.cc4
-rw-r--r--net/socket/socks5_client_socket.cc2
-rw-r--r--net/socket/socks_client_socket.cc2
-rw-r--r--net/socket/ssl_client_socket_openssl.cc522
-rw-r--r--net/socket/ssl_client_socket_openssl.h141
-rw-r--r--net/socket/tcp_client_socket_pool.cc2
-rw-r--r--net/url_request/url_request.h4
-rw-r--r--net/url_request/url_request_job.cc2
-rw-r--r--net/url_request/url_request_job_manager.cc2
-rw-r--r--sdch/open-vcdiff/src/gflags/gflags.h6
-rw-r--r--third_party/libevent/android/config.h268
-rw-r--r--third_party/libevent/android/event-config.h274
-rw-r--r--third_party/libevent/event.c4
-rw-r--r--third_party/libevent/evutil.c4
-rw-r--r--third_party/libevent/select.c5
70 files changed, 2085 insertions, 354 deletions
diff --git a/Android.mk b/Android.mk
index c3651c5..49d2f74 100644
--- a/Android.mk
+++ b/Android.mk
@@ -4,118 +4,9 @@ include $(CLEAR_VARS)
LOCAL_CPP_EXTENSION := .cc
+LOCAL_ARM_MODE := arm
+
LOCAL_SRC_FILES := \
- base/at_exit.cc \
- base/atomicops_internals_x86_gcc.cc \
- base/base64.cc \
- base/base_paths.cc \
- base/base_paths_posix.cc \
- base/base_switches.cc \
- base/bzip2_error_handler.cc \
- base/cancellation_flag.cc \
- base/command_line.cc \
- base/condition_variable_posix.cc \
- base/crypto/rsa_private_key.cc \
- base/data_pack.cc \
- base/debug_util.cc \
- base/debug_util_posix.cc \
- base/directory_watcher_inotify.cc \
- base/dynamic_annotations.cc \
- base/event_recorder_stubs.cc \
- base/field_trial.cc \
- base/file_descriptor_shuffle.cc \
- base/file_path.cc \
- base/file_util.cc \
- base/file_util_linux.cc \
- base/file_util_posix.cc \
- base/global_descriptors_posix.cc \
- base/histogram.cc \
- base/hmac_nss.o \
- base/i18n/file_util_icu.cc \
- base/i18n/icu_string_conversions.cc \
- base/i18n/icu_util.cc \
- base/i18n/number_formatting.cc \
- base/i18n/time_formatting.cc \
- base/i18n/word_iterator.cc \
- base/json/json_reader.cc \
- base/json/json_writer.cc \
- base/json/string_escape.cc \
- base/lazy_instance.cc \
- base/linux_util.cc \
- base/lock.cc \
- base/lock_impl_posix.cc \
- base/logging.cc \
- base/md5.cc \
- base/memory_debug.cc \
- base/message_loop.cc \
- base/message_pump_default.cc \
- base/message_pump_libevent.cc \
- base/mime_util_linux.cc \
- base/native_library_linux.cc \
- base/non_thread_safe.cc \
- base/path_service.cc \
- base/pickle.cc \
- base/platform_file_posix.cc \
- base/platform_thread_posix.cc \
- base/process_linux.cc \
- base/process_posix.cc \
- base/process_util_linux.cc \
- base/process_util_posix.cc \
- base/profiler.cc \
- base/rand_util.cc \
- base/rand_util_posix.cc \
- base/ref_counted.cc \
- base/safe_strerror_posix.cc \
- base/scoped_temp_dir.cc \
- base/setproctitle_linux.c \
- base/sha1.cc \
- base/sha2.cc \
- base/shared_memory_posix.cc \
- base/simple_thread.cc \
- base/stats_table.cc \
- base/string16.cc \
- base/string_piece.cc \
- base/string_split.cc \
- base/string_util.cc \
- base/sync_socket_posix.cc \
- base/sys_info_linux.cc \
- base/sys_info_posix.cc \
- base/sys_string_conversions_linux.cc \
- base/third_party/dmg_fp/dtoa.cc \
- base/third_party/dmg_fp/g_fmt.cc \
- base/third_party/icu/icu_utf.cc \
- base/third_party/nspr/prtime.cc \
- base/third_party/nss/sha512.cc \
- base/third_party/xdg_mime/xdgmime.c \
- base/third_party/xdg_mime/xdgmimealias.c \
- base/third_party/xdg_mime/xdgmimecache.c \
- base/third_party/xdg_mime/xdgmimeglob.c \
- base/third_party/xdg_mime/xdgmimeicon.c \
- base/third_party/xdg_mime/xdgmimeint.c \
- base/third_party/xdg_mime/xdgmimemagic.c \
- base/third_party/xdg_mime/xdgmimeparent.c \
- base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc \
- base/thread.cc \
- base/thread_collision_warner.cc \
- base/thread_local_posix.cc \
- base/thread_local_storage_posix.cc \
- base/time.cc \
- base/time_posix.cc \
- base/timer.cc \
- base/trace_event.cc \
- base/tracked.cc \
- base/tracked_objects.cc \
- base/unix_domain_socket_posix.cc \
- base/utf_offset_string_conversions.cc \
- base/utf_string_conversion_utils.cc \
- base/utf_string_conversions.cc \
- base/values.cc \
- base/version.cc \
- base/waitable_event_posix.cc \
- base/waitable_event_watcher_posix.cc \
- base/watchdog.cc \
- base/worker_pool_linux.cc \
- \
googleurl/src/gurl.cc \
googleurl/src/url_canon_etc.cc \
googleurl/src/url_canon_fileurl.cc \
@@ -133,208 +24,282 @@ LOCAL_SRC_FILES := \
googleurl/src/url_parse_file.cc \
googleurl/src/url_util.cc \
\
- net/base/address_list.cc \
- net/base/cert_status_flags.cc \
- net/base/connection_type_histograms.cc \
- net/base/cookie_monster.cc \
- net/base/data_url.cc \
- net/base/directory_lister.cc \
- net/base/dns_util.cc \
- net/base/escape.cc \
- net/base/file_stream_posix.cc \
- net/base/filter.cc \
- net/base/fixed_host_resolver.cc \
- net/base/gzip_filter.cc \
- net/base/gzip_header.cc \
- net/base/host_cache.cc \
- net/base/host_resolver.cc \
- net/base/host_resolver_impl.cc \
- net/base/host_resolver_proc.cc \
- net/base/https_prober.cc \
- net/base/io_buffer.cc \
- net/base/listen_socket.cc \
- net/base/load_log.cc \
- net/base/load_log_util.cc \
- net/base/mime_sniffer.cc \
- net/base/mime_util.cc \
- net/base/mock_host_resolver.cc \
- net/base/net_errors.cc \
- net/base/net_module.cc \
- net/base/net_util.cc \
- net/base/net_util_posix.cc \
- net/base/network_change_notifier.cc \
- net/base/network_change_notifier_helper.cc \
- net/base/network_change_notifier_linux.cc \
- net/base/platform_mime_util_linux.cc \
- net/base/registry_controlled_domain.cc \
- net/base/sdch_filter.cc \
- net/base/sdch_manager.cc \
- net/base/ssl_client_auth_cache.cc \
- net/base/ssl_config_service.cc \
- net/base/static_cookie_policy.cc \
- net/base/telnet_server.cc \
- net/base/transport_security_state.cc \
- net/base/upload_data.cc \
- net/base/upload_data_stream.cc \
- net/base/x509_certificate.cc \
- net/disk_cache/addr.cc \
- net/disk_cache/backend_impl.cc \
- net/disk_cache/bitmap.cc \
- net/disk_cache/block_files.cc \
- net/disk_cache/cache_util_posix.cc \
- net/disk_cache/entry_impl.cc \
- net/disk_cache/eviction.cc \
- net/disk_cache/file_lock.cc \
- net/disk_cache/file_posix.cc \
- net/disk_cache/hash.cc \
- net/disk_cache/mapped_file_posix.cc \
- net/disk_cache/mem_backend_impl.cc \
- net/disk_cache/mem_entry_impl.cc \
- net/disk_cache/mem_rankings.cc \
- net/disk_cache/rankings.cc \
- net/disk_cache/sparse_control.cc \
- net/disk_cache/stats.cc \
- net/disk_cache/stats_histogram.cc \
- net/disk_cache/trace.cc \
- net/flip/flip_frame_builder.cc \
- net/flip/flip_framer.cc \
- net/flip/flip_io_buffer.cc \
- net/flip/flip_network_transaction.cc \
- net/flip/flip_session.cc \
- net/flip/flip_session_pool.cc \
- net/flip/flip_stream.cc \
- net/ftp/ftp_auth_cache.cc \
- net/ftp/ftp_ctrl_response_buffer.cc \
- net/ftp/ftp_directory_listing_buffer.cc \
- net/ftp/ftp_directory_listing_parser.cc \
- net/ftp/ftp_directory_listing_parser_ls.cc \
- net/ftp/ftp_directory_listing_parser_mlsd.cc \
- net/ftp/ftp_directory_listing_parser_netware.cc \
- net/ftp/ftp_directory_listing_parser_vms.cc \
- net/ftp/ftp_directory_listing_parser_windows.cc \
- net/ftp/ftp_network_layer.cc \
- net/ftp/ftp_network_transaction.cc \
- net/ftp/ftp_server_type_histograms.cc \
- net/ftp/ftp_util.cc \
- net/http/http_auth.cc \
- net/http/http_auth_cache.cc \
- net/http/http_auth_handler.cc \
- net/http/http_auth_handler_basic.cc \
- net/http/http_auth_handler_digest.cc \
- net/http/http_auth_handler_negotiate_posix.cc \
- net/http/http_auth_handler_ntlm.cc \
- net/http/http_auth_handler_ntlm_portable.cc \
- net/http/http_basic_stream.cc \
- net/http/http_byte_range.cc \
- net/http/http_cache.cc \
- net/http/http_cache_transaction.cc \
- net/http/http_chunked_decoder.cc \
- net/http/http_network_layer.cc \
- net/http/http_network_session.cc \
- net/http/http_network_transaction.cc \
- net/http/http_response_headers.cc \
- net/http/http_response_info.cc \
- net/http/http_stream_parser.cc \
- net/http/http_util.cc \
- net/http/http_util_icu.cc \
- net/http/http_vary_data.cc \
- net/http/md4.cc \
- net/http/partial_data.cc \
- net/proxy/init_proxy_resolver.cc \
- net/proxy/proxy_config.cc \
- net/proxy/proxy_info.cc \
- net/proxy/proxy_list.cc \
- net/proxy/proxy_resolver_js_bindings.cc \
- net/proxy/proxy_script_fetcher.cc \
- net/proxy/proxy_server.cc \
- net/proxy/proxy_service.cc \
- net/proxy/single_threaded_proxy_resolver.cc \
- net/socket/client_socket_factory.cc \
- net/socket/client_socket_handle.cc \
- net/socket/client_socket_pool_base.cc \
- net/socket/socks5_client_socket.cc \
- net/socket/socks_client_socket.cc \
- net/socket/tcp_client_socket_libevent.cc \
- net/socket/tcp_client_socket_pool.cc \
- net/socket_stream/socket_stream.cc \
- net/socket_stream/socket_stream_metrics.cc \
- net/socket_stream/socket_stream_throttle.cc \
- net/url_request/url_request.cc \
- net/url_request/url_request_about_job.cc \
- net/url_request/url_request_data_job.cc \
- net/url_request/url_request_error_job.cc \
- net/url_request/url_request_file_dir_job.cc \
- net/url_request/url_request_file_job.cc \
- net/url_request/url_request_filter.cc \
- net/url_request/url_request_http_job.cc \
- net/url_request/url_request_job.cc \
- net/url_request/url_request_job_manager.cc \
- net/url_request/url_request_job_metrics.cc \
- net/url_request/url_request_job_tracker.cc \
- net/url_request/url_request_new_ftp_job.cc \
- net/url_request/url_request_redirect_job.cc \
- net/url_request/url_request_simple_job.cc \
- net/url_request/url_request_view_net_internals_job.cc \
- net/url_request/view_cache_helper.cc \
- net/websockets/websocket.cc \
- net/websockets/websocket_throttle.cc \
- \
- sdch/open-vcdiff/src/addrcache.cc \
- sdch/open-vcdiff/src/adler32.c \
- sdch/open-vcdiff/src/blockhash.cc \
- sdch/open-vcdiff/src/codetable.cc \
- sdch/open-vcdiff/src/decodetable.cc \
- sdch/open-vcdiff/src/encodetable.cc \
- sdch/open-vcdiff/src/headerparser.cc \
- sdch/open-vcdiff/src/instruction_map.cc \
- sdch/open-vcdiff/src/logging.cc \
- sdch/open-vcdiff/src/varint_bigendian.cc \
- sdch/open-vcdiff/src/vcdecoder.cc \
- sdch/open-vcdiff/src/vcdiffengine.cc \
+ app/sql/connection.cc \
+ app/sql/meta_table.cc \
+ app/sql/statement.cc \
+ app/sql/transaction.cc \
\
-
-# Need to build libevent separately (possibly other libs as well)
-#\
- third_party/libevent/buffer.c \
- third_party/libevent/devpoll.c \
- third_party/libevent/epoll.c \
- third_party/libevent/epoll_sub.c \
- third_party/libevent/evbuffer.c \
- third_party/libevent/evdns.c \
- third_party/libevent/event.c \
- third_party/libevent/event_tagging.c \
- third_party/libevent/evrpc.c \
- third_party/libevent/evutil.c \
- third_party/libevent/http.c \
- third_party/libevent/log.c \
- third_party/libevent/poll.c \
- third_party/libevent/select.c \
- third_party/libevent/signal.c \
- third_party/libevent/strlcpy.c \
-
-LOCAL_SRC_FILES += \
- third_party/zlib/contrib/minizip/ioapi.c \
- third_party/zlib/contrib/minizip/unzip.c \
- third_party/zlib/contrib/minizip/zip.c
+ base/at_exit.cc \
+ base/base64.cc \
+ base/cancellation_flag.cc \
+ base/condition_variable_posix.cc \
+ base/debug_util_posix.cc \
+ base/field_trial.cc \
+ base/file_descriptor_shuffle.cc \
+ base/file_path.cc \
+ base/file_util.cc \
+ base/file_util_android.cc \
+ base/file_util_posix.cc \
+ base/histogram.cc \
+ base/lazy_instance.cc \
+ base/lock_impl_posix.cc \
+ base/logging.cc \
+ base/message_loop.cc \
+ base/message_loop_proxy_impl.cc \
+ base/message_pump_libevent.cc \
+ base/message_pump_default.cc \
+ base/md5.cc \
+ base/native_library_linux.cc \
+ base/pickle.cc \
+ base/platform_file_posix.cc \
+ base/platform_thread_posix.cc \
+ base/process_util.cc \
+ base/process_util_linux.cc \
+ base/process_util_posix.cc \
+ base/rand_util.cc \
+ base/rand_util_posix.cc \
+ base/ref_counted.cc \
+ base/safe_strerror_posix.cc \
+ base/sha1.cc \
+ base/sha2.cc \
+ base/stats_table.cc \
+ base/string_piece.cc \
+ base/string_util.cc \
+ base/string16.cc \
+ base/sys_info_posix.cc \
+ base/sys_string_conversions_linux.cc \
+ base/task.cc \
+ base/thread.cc \
+ base/thread_local_posix.cc \
+ base/thread_local_storage_posix.cc \
+ base/time.cc \
+ base/time_posix.cc \
+ base/timer.cc \
+ base/trace_event.cc \
+ base/tracked.cc \
+ base/waitable_event_posix.cc \
+ base/utf_offset_string_conversions.cc \
+ base/utf_string_conversions.cc \
+ base/utf_string_conversion_utils.cc \
+ base/values.cc \
+ base/weak_ptr.cc \
+ base/worker_pool_linux.cc \
+ \
+ base/i18n/file_util_icu.cc \
+ base/i18n/time_formatting.cc \
+ \
+ base/json/json_reader.cc \
+ base/json/json_writer.cc \
+ base/json/string_escape.cc \
+ \
+ base/i18n/icu_string_conversions.cc \
+ \
+ base/third_party/dmg_fp/dtoa.cc \
+ base/third_party/dmg_fp/g_fmt.cc \
+ \
+ base/third_party/icu/icu_utf.cc \
+ \
+ base/third_party/nspr/prtime.cc \
+ \
+ base/third_party/nss/sha512.cc \
+ \
+ chrome/browser/net/sqlite_persistent_cookie_store.cc \
+ \
+ third_party/modp_b64/modp_b64.cc \
+ \
+ net/base/address_list.cc \
+ net/base/address_list_net_log_param.cc \
+ net/base/capturing_net_log.cc \
+ net/base/connection_type_histograms.cc \
+ net/base/cookie_monster.cc \
+ net/base/data_url.cc \
+ net/base/directory_lister.cc \
+ net/base/dns_util.cc \
+ net/base/escape.cc \
+ net/base/file_stream_posix.cc \
+ net/base/filter.cc \
+ net/base/forwarding_net_log.cc \
+ net/base/gzip_filter.cc \
+ net/base/gzip_header.cc \
+ net/base/host_cache.cc \
+ net/base/host_mapping_rules.cc \
+ net/base/host_port_pair.cc \
+ net/base/host_resolver.cc \
+ net/base/host_resolver_impl.cc \
+ net/base/host_resolver_proc.cc \
+ net/base/https_prober.cc \
+ net/base/io_buffer.cc \
+ net/base/load_log.cc \
+ net/base/mime_util.cc \
+ net/base/net_errors.cc \
+ net/base/net_log.cc \
+ net/base/net_module.cc \
+ net/base/net_util.cc \
+ net/base/net_util_posix.cc \
+ net/base/network_change_notifier.cc \
+ net/base/network_change_notifier_linux.cc \
+ net/base/network_change_notifier_netlink_linux.cc \
+ net/base/registry_controlled_domain.cc \
+ net/base/sdch_manager.cc \
+ net/base/sdch_filter.cc \
+ net/base/ssl_client_auth_cache.cc \
+ net/base/ssl_config_service.cc \
+ net/base/transport_security_state.cc \
+ net/base/upload_data.cc \
+ net/base/upload_data_stream.cc \
+ net/base/x509_certificate.cc \
+ net/base/x509_certificate_openssl.cc \
+ \
+ net/disk_cache/addr.cc \
+ net/disk_cache/backend_impl.cc \
+ net/disk_cache/bitmap.cc \
+ net/disk_cache/block_files.cc \
+ net/disk_cache/cache_util_posix.cc \
+ net/disk_cache/entry_impl.cc \
+ net/disk_cache/eviction.cc \
+ net/disk_cache/file_lock.cc \
+ net/disk_cache/file_posix.cc \
+ net/disk_cache/hash.cc \
+ net/disk_cache/in_flight_backend_io.cc \
+ net/disk_cache/in_flight_io.cc \
+ net/disk_cache/mapped_file_posix.cc \
+ net/disk_cache/mem_backend_impl.cc \
+ net/disk_cache/mem_entry_impl.cc \
+ net/disk_cache/mem_rankings.cc \
+ net/disk_cache/rankings.cc \
+ net/disk_cache/stats.cc \
+ net/disk_cache/stats_histogram.cc \
+ net/disk_cache/sparse_control.cc \
+ net/disk_cache/trace.cc \
+ \
+ net/spdy/spdy_framer.cc \
+ net/spdy/spdy_frame_builder.cc \
+ net/spdy/spdy_http_stream.cc \
+ net/spdy/spdy_io_buffer.cc \
+ net/spdy/spdy_network_transaction.cc \
+ net/spdy/spdy_session.cc \
+ net/spdy/spdy_session_pool.cc \
+ net/spdy/spdy_settings_storage.cc \
+ net/spdy/spdy_stream.cc \
+ \
+ net/http/des.cc \
+ net/http/http_alternate_protocols.cc \
+ net/http/http_auth.cc \
+ net/http/http_auth_cache.cc \
+ net/http/http_auth_controller.cc \
+ net/http/http_auth_gssapi_posix.cc \
+ net/http/http_auth_handler.cc \
+ net/http/http_auth_handler_basic.cc \
+ net/http/http_auth_handler_digest.cc \
+ net/http/http_auth_handler_factory.cc \
+ net/http/http_auth_handler_negotiate.cc \
+ net/http/http_auth_handler_ntlm.cc \
+ net/http/http_auth_handler_ntlm_portable.cc \
+ net/http/http_basic_stream.cc \
+ net/http/http_byte_range.cc \
+ net/http/http_cache.cc \
+ net/http/http_cache_transaction.cc \
+ net/http/http_chunked_decoder.cc \
+ net/http/http_network_layer.cc \
+ net/http/http_network_session.cc \
+ net/http/http_network_transaction.cc \
+ net/http/http_proxy_client_socket.cc \
+ net/http/http_proxy_client_socket_pool.cc \
+ net/http/http_request_headers.cc \
+ net/http/http_response_headers.cc \
+ net/http/http_response_info.cc \
+ net/http/http_stream_parser.cc \
+ net/http/http_util.cc \
+ net/http/http_util_icu.cc \
+ net/http/http_vary_data.cc \
+ net/http/md4.cc \
+ net/http/partial_data.cc \
+ \
+ net/proxy/init_proxy_resolver.cc \
+ net/proxy/proxy_bypass_rules.cc \
+ net/proxy/proxy_config.cc \
+ net/proxy/proxy_info.cc \
+ net/proxy/proxy_list.cc \
+ net/proxy/multi_threaded_proxy_resolver.cc \
+ net/proxy/proxy_resolver_js_bindings.cc \
+ net/proxy/proxy_resolver_script_data.cc \
+ net/proxy/proxy_resolver_v8.cc \
+ net/proxy/proxy_script_fetcher.cc \
+ net/proxy/proxy_server.cc \
+ net/proxy/proxy_service.cc \
+ net/proxy/sync_host_resolver_bridge.cc \
+ \
+ net/socket/client_socket_handle.cc \
+ net/socket/client_socket_factory.cc \
+ net/socket/client_socket_pool.cc \
+ net/socket/client_socket_pool_base.cc \
+ net/socket/client_socket_pool_histograms.cc \
+ net/socket/socks_client_socket.cc \
+ net/socket/socks_client_socket_pool.cc \
+ net/socket/socks5_client_socket.cc \
+ net/socket/ssl_client_socket_openssl.cc \
+ net/socket/ssl_client_socket_pool.cc \
+ net/socket/tcp_client_socket_libevent.cc \
+ net/socket/tcp_client_socket_pool.cc \
+ \
+ net/url_request/url_request.cc \
+ net/url_request/url_request_file_job.cc \
+ net/url_request/url_request_file_dir_job.cc \
+ net/url_request/url_request_http_job.cc \
+ net/url_request/url_request_error_job.cc \
+ net/url_request/url_request_job.cc \
+ net/url_request/url_request_job_manager.cc \
+ net/url_request/url_request_job_tracker.cc \
+ net/url_request/url_request_netlog_params.cc \
+ net/url_request/url_request_redirect_job.cc \
+ \
+ sdch/open-vcdiff/src/addrcache.cc \
+ sdch/open-vcdiff/src/blockhash.cc \
+ sdch/open-vcdiff/src/codetable.cc \
+ sdch/open-vcdiff/src/encodetable.cc \
+ sdch/open-vcdiff/src/decodetable.cc \
+ sdch/open-vcdiff/src/headerparser.cc \
+ sdch/open-vcdiff/src/instruction_map.cc \
+ sdch/open-vcdiff/src/logging.cc \
+ sdch/open-vcdiff/src/varint_bigendian.cc \
+ sdch/open-vcdiff/src/vcdecoder.cc \
+ sdch/open-vcdiff/src/vcdiffengine.cc \
+ sdch/open-vcdiff/src/vcencoder.cc \
+ \
+ third_party/libevent/event.c \
+ third_party/libevent/evutil.c \
+ third_party/libevent/epoll.c \
+ third_party/libevent/log.c \
+ third_party/libevent/poll.c \
+ third_party/libevent/select.c \
+ third_party/libevent/signal.c
# external/chromium/android is a directory to intercept stl headers that we do
# not support yet.
LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/android \
- $(LOCAL_PATH)/sdch/linux \
- $(LOCAL_PATH)/sdch/open-vcdiff/src \
- $(LOCAL_PATH)/third_party/libevent/compat \
- external/icu4c/common \
- external/icu4c/i18n \
- external/zlib
+ $(LOCAL_PATH)/android \
+ $(LOCAL_PATH)/chrome/browser \
+ $(LOCAL_PATH)/sdch/linux \
+ $(LOCAL_PATH)/sdch/open-vcdiff/src \
+ $(LOCAL_PATH)/third_party/libevent/compat \
+ external/icu4c/common \
+ external/icu4c/i18n \
+ external/openssl/include \
+ external/sqlite/dist \
+ external/zlib \
+ external \
+ bionic \
+ bionic/libc/include \
+ $(LOCAL_PATH)/base/third_party/dmg_fp \
+ $(LOCAL_PATH)/third_party/icu/public/common \
+ $(LOCAL_PATH)/third_party/libevent/android \
+ $(LOCAL_PATH)/third_party/libevent
-#include external/stlport/libstlport.mk
+include external/stlport/libstlport.mk
# include a prefix header for missing headers or definitions.
-LOCAL_CFLAGS := -include "android/prefix.h"
-
-LOCAL_MODULE := chromium_net
+LOCAL_CFLAGS := -DHAVE_CONFIG_H -DANDROID -include "android/prefix.h" -fvisibility=hidden
-LOCAL_SHARED_LIBRARIES := libstlport libz
+LOCAL_MODULE := libchromium_net
-#include $(BUILD_STATIC_LIBRARY)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/android/prefix.h b/android/prefix.h
index 88a28ed..7c174f2 100644
--- a/android/prefix.h
+++ b/android/prefix.h
@@ -9,11 +9,6 @@ using std::find;
using std::reverse;
using std::search;
-// Our pwrite has buf declared void*.
-ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) {
- return pwrite(fd, const_cast<void*>(buf), count, offset);
-}
-
// Called by command_line.cc to shorten the process name. Not needed for
// network stack.
inline int prctl(int option, ...) { return 0; }
@@ -43,10 +38,13 @@ inline size_t abs(size_t x) { return x; }
extern char* mkdtemp(char* path);
extern time_t timegm(struct tm* const tmp);
+#define FRIEND_TEST(test_case_name, test_name)\
+friend class test_case_name##_##test_name##_Test
+
// This will probably need a real implementation.
-#define F_ULOCK 0
-#define F_LOCK 1
-inline int lockf(int fd, int cmd, off_t len) { return -1; }
+//#define F_ULOCK 0
+//#define F_LOCK 1
+//inline int lockf(int fd, int cmd, off_t len) { return -1; }
// We have posix monotonic clocks but don't define this...
#define _POSIX_MONOTONIC_CLOCK 1
diff --git a/android/testing/gtest/include/gtest/gtest_prod.h b/android/testing/gtest/include/gtest/gtest_prod.h
new file mode 100644
index 0000000..55c7fdd
--- /dev/null
+++ b/android/testing/gtest/include/gtest/gtest_prod.h
@@ -0,0 +1,3 @@
+#define FRIEND_TEST(test_case_name, test_name)\
+friend class test_case_name##_##test_name##_Test
+
diff --git a/android/testing/platform_test.h b/android/testing/platform_test.h
new file mode 100644
index 0000000..55c7fdd
--- /dev/null
+++ b/android/testing/platform_test.h
@@ -0,0 +1,3 @@
+#define FRIEND_TEST(test_case_name, test_name)\
+friend class test_case_name##_##test_name##_Test
+
diff --git a/app/sql/connection.cc b/app/sql/connection.cc
index 81f3d36..ba40a11 100644
--- a/app/sql/connection.cc
+++ b/app/sql/connection.cc
@@ -11,7 +11,11 @@
#include "base/logging.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#ifdef ANDROID
+#include "sqlite3.h"
+#else
#include "third_party/sqlite/preprocessed/sqlite3.h"
+#endif
namespace sql {
@@ -81,6 +85,15 @@ void Connection::Close() {
}
}
+#ifdef ANDROID
+// Other platforms may need this ???
+// This function is a local change to sqlite3 which doesn't exist when one is
+// using the system sqlite library. Thus, we stub it out here.
+int sqlite3Preload(sqlite3* db) {
+ return 0;
+}
+#endif
+
void Connection::Preload() {
if (!db_) {
NOTREACHED();
diff --git a/app/sql/statement.cc b/app/sql/statement.cc
index 639b02d..4ac9c2e 100644
--- a/app/sql/statement.cc
+++ b/app/sql/statement.cc
@@ -6,7 +6,11 @@
#include "base/logging.h"
#include "base/utf_string_conversions.h"
+#ifdef ANDROID
+#include "sqlite3.h"
+#else
#include "third_party/sqlite/preprocessed/sqlite3.h"
+#endif
namespace sql {
diff --git a/base/compat_execinfo.h b/base/compat_execinfo.h
index 348c5cd..13e4967 100644
--- a/base/compat_execinfo.h
+++ b/base/compat_execinfo.h
@@ -14,7 +14,7 @@
#include <AvailabilityMacros.h>
#endif
-#if defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+#if (defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) || defined(ANDROID)
// Manually define these here as weak imports, rather than including execinfo.h.
// This lets us launch on 10.4 which does not have these calls.
extern "C" {
diff --git a/base/debug_util_posix.cc b/base/debug_util_posix.cc
index 110cb20..0070008 100644
--- a/base/debug_util_posix.cc
+++ b/base/debug_util_posix.cc
@@ -116,6 +116,8 @@ bool GetBacktraceStrings(void **trace, int size,
}
}
#else
+ return false; // For now on Android
+/*
scoped_ptr_malloc<char*> trace_symbols(backtrace_symbols(trace, size));
if (trace_symbols.get()) {
for (int i = 0; i < size; ++i) {
@@ -129,6 +131,7 @@ bool GetBacktraceStrings(void **trace, int size,
trace_strings->push_back(StringPrintf("%p", trace[i]));
}
}
+*/
#endif // defined(USE_SYMBOLIZE)
return symbolized;
@@ -259,11 +262,15 @@ void DebugUtil::BreakDebugger() {
}
StackTrace::StackTrace() {
-#if defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+#if (defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) || defined(ANDROID)
+#if defined(ANDROID)
+ return;
+#else
if (backtrace == NULL) {
count_ = 0;
return;
}
+#endif // ANDROID
#endif
// Though the backtrace API man page does not list any possible negative
// return values, we take no chance.
@@ -271,9 +278,13 @@ StackTrace::StackTrace() {
}
void StackTrace::PrintBacktrace() {
-#if defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+#if (defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) || defined(ANDROID)
+#if defined(ANDROID)
+ return;
+#else
if (backtrace_symbols_fd == NULL)
return;
+#endif // ANDROID
#endif
fflush(stderr);
std::vector<std::string> trace_strings;
@@ -284,9 +295,13 @@ void StackTrace::PrintBacktrace() {
}
void StackTrace::OutputToStream(std::ostream* os) {
-#if defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+#if (defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) || defined(ANDROID)
+#if defined(ANDROID)
+ return;
+#else
if (backtrace_symbols == NULL)
return;
+#endif // ANDROID
#endif
std::vector<std::string> trace_strings;
if (GetBacktraceStrings(trace_, count_, &trace_strings)) {
diff --git a/base/file_path.h b/base/file_path.h
index 6887cdc..e14655c 100644
--- a/base/file_path.h
+++ b/base/file_path.h
@@ -367,7 +367,7 @@ class FilePath {
// Provide a hash function so that hash_sets and maps can contain FilePath
// objects.
#if defined(COMPILER_GCC)
-namespace __gnu_cxx {
+namespace std {
template<>
struct hash<FilePath> {
diff --git a/base/file_util_android.cc b/base/file_util_android.cc
new file mode 100644
index 0000000..59fb2de
--- /dev/null
+++ b/base/file_util_android.cc
@@ -0,0 +1,162 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/file_util.h"
+
+#include <fcntl.h>
+
+#include <string>
+#include <vector>
+
+#include "base/eintr_wrapper.h"
+#include "base/file_path.h"
+#include "base/string_util.h"
+
+// just lifted off bionic, no should find out why it doesn't get linked in
+
+static int _gettemp(char *, int *, int, int);
+
+extern uint32_t arc4random();
+
+int
+mkstemps(char *path, int slen)
+{
+ int fd;
+
+ return (_gettemp(path, &fd, 0, slen) ? fd : -1);
+}
+
+int
+mkstemp(char *path)
+{
+ int fd;
+
+ return (_gettemp(path, &fd, 0, 0) ? fd : -1);
+}
+
+char *
+mkdtemp(char *path)
+{
+ return(_gettemp(path, (int *)NULL, 1, 0) ? path : (char *)NULL);
+}
+
+char *_mktemp(char *);
+
+char *
+_mktemp(char *path)
+{
+ return(_gettemp(path, (int *)NULL, 0, 0) ? path : (char *)NULL);
+}
+
+__warn_references(mktemp,
+ "warning: mktemp() possibly used unsafely; consider using mkstemp()");
+
+char *
+mktemp(char *path)
+{
+ return(_mktemp(path));
+}
+
+
+static int
+_gettemp(char *path, int *doopen, int domkdir, int slen)
+{
+ char *start, *trv, *suffp;
+ struct stat sbuf;
+ int rval;
+ pid_t pid;
+
+ if (doopen && domkdir) {
+ errno = EINVAL;
+ return(0);
+ }
+
+ for (trv = path; *trv; ++trv)
+ ;
+ trv -= slen;
+ suffp = trv;
+ --trv;
+ if (trv < path) {
+ errno = EINVAL;
+ return (0);
+ }
+ pid = getpid();
+ while (trv >= path && *trv == 'X' && pid != 0) {
+ *trv-- = (pid % 10) + '0';
+ pid /= 10;
+ }
+ while (trv >= path && *trv == 'X') {
+ char c;
+
+ pid = (arc4random() & 0xffff) % (26+26);
+ if (pid < 26)
+ c = pid + 'A';
+ else
+ c = (pid - 26) + 'a';
+ *trv-- = c;
+ }
+ start = trv + 1;
+
+ /*
+ * check the target directory; if you have six X's and it
+ * doesn't exist this runs for a *very* long time.
+ */
+ if (doopen || domkdir) {
+ for (;; --trv) {
+ if (trv <= path)
+ break;
+ if (*trv == '/') {
+ *trv = '\0';
+ rval = stat(path, &sbuf);
+ *trv = '/';
+ if (rval != 0)
+ return(0);
+ if (!S_ISDIR(sbuf.st_mode)) {
+ errno = ENOTDIR;
+ return(0);
+ }
+ break;
+ }
+ }
+ }
+
+ for (;;) {
+ if (doopen) {
+ if ((*doopen =
+ open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0)
+ return(1);
+ if (errno != EEXIST)
+ return(0);
+ } else if (domkdir) {
+ if (mkdir(path, 0700) == 0)
+ return(1);
+ if (errno != EEXIST)
+ return(0);
+ } else if (lstat(path, &sbuf))
+ return(errno == ENOENT ? 1 : 0);
+
+ /* tricky little algorithm for backward compatibility */
+ for (trv = start;;) {
+ if (!*trv)
+ return (0);
+ if (*trv == 'Z') {
+ if (trv == suffp)
+ return (0);
+ *trv++ = 'a';
+ } else {
+ if (isdigit(*trv))
+ *trv = 'a';
+ else if (*trv == 'z') /* inc from z to A */
+ *trv = 'A';
+ else {
+ if (trv == suffp)
+ return (0);
+ ++*trv;
+ }
+ break;
+ }
+ }
+ }
+ /*NOTREACHED*/
+}
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 434c859..08eed63 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -24,7 +24,7 @@
#if defined(OS_MACOSX)
#include <AvailabilityMacros.h>
-#else
+#elif !defined(ANDROID)
#include <glib.h>
#endif
@@ -782,6 +782,7 @@ bool GetShmemTempDir(FilePath* path) {
}
FilePath GetHomeDir() {
+#ifndef ANDROID
const char* home_dir = getenv("HOME");
if (home_dir && home_dir[0])
return FilePath(home_dir);
@@ -793,7 +794,7 @@ FilePath GetHomeDir() {
FilePath rv;
if (file_util::GetTempDir(&rv))
return rv;
-
+#endif
// Last resort.
return FilePath("/tmp");
}
diff --git a/base/hash_tables.h b/base/hash_tables.h
index ad7d465..747aa86 100644
--- a/base/hash_tables.h
+++ b/base/hash_tables.h
@@ -41,8 +41,8 @@ using stdext::hash_set;
#undef __DEPRECATED
#endif
-#include <ext/hash_map>
-#include <ext/hash_set>
+#include <hash_map>
+#include <hash_set>
#include <string>
#ifdef CHROME_OLD__DEPRECATED
@@ -51,11 +51,14 @@ using stdext::hash_set;
#endif
namespace base {
-using __gnu_cxx::hash_map;
-using __gnu_cxx::hash_set;
+using std::hash_map;
+using std::hash_set;
} // namespace base
-namespace __gnu_cxx {
+namespace std {
+
+#ifndef ANDROID
+// Already defined for android
// The GNU C++ library provides identiy hash functions for many integral types,
// but not for |long long|. This hash function will truncate if |size_t| is
@@ -74,6 +77,7 @@ DEFINE_TRIVIAL_HASH(long long);
DEFINE_TRIVIAL_HASH(unsigned long long);
#undef DEFINE_TRIVIAL_HASH
+#endif
// Implement string hash functions so that strings of various flavors can
// be used as keys in STL maps and sets. The hash algorithm comes from the
diff --git a/base/logging.cc b/base/logging.cc
index 851bdcc..af1ab06 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -31,6 +31,7 @@ typedef HANDLE MutexHandle;
#include <unistd.h>
#define MAX_PATH PATH_MAX
typedef FILE* FileHandle;
+#include "pthread.h"
typedef pthread_mutex_t* MutexHandle;
#endif
@@ -248,7 +249,11 @@ void InitLogMutex() {
void InitLogging(const PathChar* new_log_file, LoggingDestination logging_dest,
LogLockingState lock_log, OldFileDeletionState delete_old) {
g_enable_dcheck =
+#ifdef ANDROID
+ false;
+#else
CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableDCHECK);
+#endif // ANDROID
if (log_file) {
// calling InitLogging twice or after some log call has already opened the
diff --git a/base/message_loop.cc b/base/message_loop.cc
index 1d86f79..3728ef2 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -135,6 +135,9 @@ MessageLoop::MessageLoop(Type type)
#elif defined(OS_MACOSX)
#define MESSAGE_PUMP_UI base::MessagePumpMac::Create()
#define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
+#elif defined(ANDROID)
+#define MESSAGE_PUMP_UI new base::MessagePumpDefault()
+#define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
#elif defined(OS_POSIX) // POSIX but not MACOSX.
#define MESSAGE_PUMP_UI new base::MessagePumpForUI()
#define MESSAGE_PUMP_IO new base::MessagePumpLibevent()
@@ -244,7 +247,7 @@ __declspec(noinline) void MessageLoop::RunInternalInSEHFrame() {
void MessageLoop::RunInternal() {
DCHECK(this == current());
- StartHistogrammer();
+// StartHistogrammer();
#if !defined(OS_MACOSX)
if (state_->dispatcher && type() == TYPE_UI) {
@@ -640,7 +643,7 @@ void MessageLoopForUI::DidProcessMessage(const MSG& message) {
}
#endif // defined(OS_WIN)
-#if !defined(OS_MACOSX)
+#if !defined(OS_MACOSX) && !defined(ANDROID)
void MessageLoopForUI::AddObserver(Observer* observer) {
pump_ui()->AddObserver(observer);
}
diff --git a/base/message_loop.h b/base/message_loop.h
index 62da3dd..ca6da55 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -493,7 +493,7 @@ class MessageLoopForUI : public MessageLoop {
// Returns the MessageLoopForUI of the current thread.
static MessageLoopForUI* current() {
MessageLoop* loop = MessageLoop::current();
- DCHECK_EQ(MessageLoop::TYPE_UI, loop->type());
+ //DCHECK_EQ(MessageLoop::TYPE_UI, loop->type());
return static_cast<MessageLoopForUI*>(loop);
}
@@ -555,7 +555,7 @@ class MessageLoopForIO : public MessageLoop {
// Returns the MessageLoopForIO of the current thread.
static MessageLoopForIO* current() {
MessageLoop* loop = MessageLoop::current();
- DCHECK_EQ(MessageLoop::TYPE_IO, loop->type());
+ //DCHECK_EQ(MessageLoop::TYPE_IO, loop->type());
return static_cast<MessageLoopForIO*>(loop);
}
diff --git a/base/process_util.h b/base/process_util.h
index 48cef2c..67501be 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -252,6 +252,9 @@ class ProcessFilter {
// Returns true to indicate set-inclusion and false otherwise. This method
// should not have side-effects and should be idempotent.
virtual bool Includes(const ProcessEntry& entry) const = 0;
+#ifdef ANDROID
+ virtual ~ProcessFilter() {}
+#endif
};
// Returns the number of processes on the machine that are running from the
diff --git a/base/stats_table.cc b/base/stats_table.cc
index 2edbb44..971cc0f 100644
--- a/base/stats_table.cc
+++ b/base/stats_table.cc
@@ -115,7 +115,9 @@ class StatsTablePrivate {
static StatsTablePrivate* New(const std::string& name, int size,
int max_threads, int max_counters);
+#ifndef ANDROID
base::SharedMemory* shared_memory() { return &shared_memory_; }
+#endif
// Accessors for our header pointers
TableHeader* table_header() const { return table_header_; }
@@ -155,7 +157,10 @@ class StatsTablePrivate {
// Initializes our in-memory pointers into a pre-created StatsTable.
void ComputeMappedPointers(void* memory);
+#ifndef ANDROID
base::SharedMemory shared_memory_;
+#endif
+
TableHeader* table_header_;
char* thread_names_table_;
PlatformThreadId* thread_tid_table_;
@@ -169,6 +174,9 @@ StatsTablePrivate* StatsTablePrivate::New(const std::string& name,
int size,
int max_threads,
int max_counters) {
+#ifdef ANDROID
+ return NULL;
+#else
scoped_ptr<StatsTablePrivate> priv(new StatsTablePrivate());
if (!priv->shared_memory_.Create(UTF8ToWide(name), false, true, size))
return NULL;
@@ -187,6 +195,7 @@ StatsTablePrivate* StatsTablePrivate::New(const std::string& name,
priv->ComputeMappedPointers(memory);
return priv.release();
+#endif
}
void StatsTablePrivate::InitializeTable(void* memory, int size,
@@ -279,6 +288,9 @@ StatsTable::~StatsTable() {
}
int StatsTable::RegisterThread(const std::string& name) {
+#ifdef ANDROID
+ return 0;
+#else
int slot = 0;
if (!impl_)
return 0;
@@ -309,6 +321,7 @@ int StatsTable::RegisterThread(const std::string& name) {
data->slot = slot;
tls_index_.Set(data);
return slot;
+#endif
}
StatsTableTLSData* StatsTable::GetTLSData() const {
@@ -441,6 +454,10 @@ int StatsTable::FindCounter(const std::string& name) {
}
int StatsTable::AddCounter(const std::string& name) {
+#ifdef ANDROID
+ return 0;
+#else
+
if (!impl_)
return 0;
@@ -468,6 +485,7 @@ int StatsTable::AddCounter(const std::string& name) {
counters_[name] = counter_id;
}
return counter_id;
+#endif
}
int* StatsTable::GetLocation(int counter_id, int slot_id) const {
diff --git a/base/string_util.cc b/base/string_util.cc
index 2488b0b..b09c049 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -774,19 +774,25 @@ bool LowerCaseEqualsASCII(string16::const_iterator a_begin,
}
#endif
+// weird string library ...
+#if !defined(ANDROID)
bool LowerCaseEqualsASCII(const char* a_begin,
const char* a_end,
const char* b) {
return DoLowerCaseEqualsASCII(a_begin, a_end, b);
}
+#endif // !ANDROID
+// weird string library ...
+#if !defined(ANDROID)
bool LowerCaseEqualsASCII(const wchar_t* a_begin,
const wchar_t* a_end,
const char* b) {
return DoLowerCaseEqualsASCII(a_begin, a_end, b);
}
+#endif // !ANDROID
-#if !defined(WCHAR_T_IS_UTF16)
+#if !defined(WCHAR_T_IS_UTF16) && !defined(ANDROID)
bool LowerCaseEqualsASCII(const char16* a_begin,
const char16* a_end,
const char* b) {
diff --git a/base/string_util_posix.h b/base/string_util_posix.h
index 75cf4b4..15a3792 100644
--- a/base/string_util_posix.h
+++ b/base/string_util_posix.h
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <string.h>
#include <wchar.h>
+#include <ctype.h>
#include "base/logging.h"
diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc
index 3f487e5..bdc7961 100644
--- a/base/sys_info_posix.cc
+++ b/base/sys_info_posix.cc
@@ -7,12 +7,14 @@
#include <errno.h>
#include <string.h>
#include <sys/param.h>
+#ifndef ANDROID
#include <sys/statvfs.h>
+#endif
#include <sys/sysctl.h>
#include <sys/utsname.h>
#include <unistd.h>
-#if !defined(OS_MACOSX)
+#if !defined(OS_MACOSX) && !defined(ANDROID)
#include <gdk/gdk.h>
#endif
@@ -39,11 +41,15 @@ int SysInfo::NumberOfProcessors() {
// static
int64 SysInfo::AmountOfFreeDiskSpace(const FilePath& path) {
+#ifdef ANDROID
+ return -1;
+#else
struct statvfs stats;
if (statvfs(path.value().c_str(), &stats) != 0) {
return -1;
}
return static_cast<int64>(stats.f_bavail) * stats.f_frsize;
+#endif
}
// static
@@ -79,6 +85,9 @@ std::string SysInfo::CPUArchitecture() {
#if !defined(OS_MACOSX)
// static
void SysInfo::GetPrimaryDisplayDimensions(int* width, int* height) {
+#ifdef ANDROID
+ return;
+#else
// Note that Bad Things Happen if this isn't called from the UI thread,
// but also that there's no way to check that from here. :(
GdkScreen* screen = gdk_screen_get_default();
@@ -86,10 +95,14 @@ void SysInfo::GetPrimaryDisplayDimensions(int* width, int* height) {
*width = gdk_screen_get_width(screen);
if (height)
*height = gdk_screen_get_height(screen);
+#endif
}
// static
int SysInfo::DisplayCount() {
+#ifdef ANDROID
+ return 1;
+#else
// Note that Bad Things Happen if this isn't called from the UI thread,
// but also that there's no way to check that from here. :(
@@ -97,6 +110,7 @@ int SysInfo::DisplayCount() {
// The number of monitors Xinerama has? We'll just use whatever GDK uses.
GdkScreen* screen = gdk_screen_get_default();
return gdk_screen_get_n_monitors(screen);
+#endif
}
#endif
diff --git a/base/third_party/nspr/prcpucfg.h b/base/third_party/nspr/prcpucfg.h
index 5643d4c..8651edd 100644
--- a/base/third_party/nspr/prcpucfg.h
+++ b/base/third_party/nspr/prcpucfg.h
@@ -34,7 +34,7 @@
#include "base/third_party/nspr/prcpucfg_win.h"
#elif defined(__APPLE__)
#include "base/third_party/nspr/prcpucfg_mac.h"
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(ANDROID)
#include "base/third_party/nspr/prcpucfg_linux.h"
#elif defined(__FreeBSD__)
#include "base/third_party/nspr/prcpucfg_freebsd.h"
diff --git a/base/third_party/nspr/prtime.cc b/base/third_party/nspr/prtime.cc
index 65f93ee..62d8b47 100644
--- a/base/third_party/nspr/prtime.cc
+++ b/base/third_party/nspr/prtime.cc
@@ -63,7 +63,7 @@
* 3. prlong.h
*/
-#include "base/third_party/nspr/prtime.h"
+#include "prtime.h"
#include "build/build_config.h"
#if defined(OS_WIN)
@@ -74,6 +74,10 @@
#include <errno.h> /* for EINVAL */
#include <time.h>
+#if defined(ANDROID)
+#include "ctype.h" // for isalpha
+#endif // ANDROID
+
/* Implements the Unix localtime_r() function for windows */
#if defined(OS_WIN)
static void localtime_r(const time_t* secs, struct tm* time) {
@@ -158,7 +162,12 @@ PR_ImplodeTime(const PRExplodedTime *exploded)
exp_tm.tm_mon = exploded->tm_month;
exp_tm.tm_year = exploded->tm_year - 1900;
+#if defined(ANDROID)
+// grrr
+ time_t absolute_time = mktime(&exp_tm);
+#else
time_t absolute_time = timegm(&exp_tm);
+#endif // broken android
// If timegm returned -1. Since we don't pass it a time zone, the only
// valid case of returning -1 is 1 second before Epoch (Dec 31, 1969).
diff --git a/base/time_posix.cc b/base/time_posix.cc
index 2490315..f1c743d 100644
--- a/base/time_posix.cc
+++ b/base/time_posix.cc
@@ -79,7 +79,8 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) {
if (is_local)
seconds = mktime(&timestruct);
else
- seconds = timegm(&timestruct);
+ seconds = mktime(&timestruct);
+// seconds = timegm(&timestruct);
int64 milliseconds;
// Handle overflow. Clamping the range to what mktime and timegm might
@@ -147,7 +148,7 @@ void Time::Explode(bool is_local, Exploded* exploded) const {
// FreeBSD 6 has CLOCK_MONOLITHIC but defines _POSIX_MONOTONIC_CLOCK to -1.
#if (defined(OS_POSIX) && \
defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0) || \
- defined(OS_FREEBSD) || defined(OS_OPENBSD)
+ defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(ANDROID)
// static
TimeTicks TimeTicks::Now() {
diff --git a/base/trace_event.cc b/base/trace_event.cc
index fbfd426..56b18c2 100644
--- a/base/trace_event.cc
+++ b/base/trace_event.cc
@@ -28,6 +28,7 @@ static const FilePath::CharType* kLogFileName =
FILE_PATH_LITERAL("trace_%d.log");
TraceLog::TraceLog() : enabled_(false), log_file_(NULL) {
+#ifndef ANDROID
base::ProcessHandle proc = base::GetCurrentProcessHandle();
#if !defined(OS_MACOSX)
process_metrics_.reset(base::ProcessMetrics::CreateProcessMetrics(proc));
@@ -36,11 +37,14 @@ TraceLog::TraceLog() : enabled_(false), log_file_(NULL) {
// process.
process_metrics_.reset(base::ProcessMetrics::CreateProcessMetrics(proc,
NULL));
-#endif
+#endif // !defined(OS_MACOSX)
+#endif // !ANDROID
}
TraceLog::~TraceLog() {
+#ifndef ANDROID
Stop();
+#endif
}
// static
@@ -56,6 +60,7 @@ bool TraceLog::StartTracing() {
}
bool TraceLog::Start() {
+#ifndef ANDROID
if (enabled_)
return true;
enabled_ = OpenLogFile();
@@ -65,6 +70,9 @@ bool TraceLog::Start() {
timer_.Start(TimeDelta::FromMilliseconds(250), this, &TraceLog::Heartbeat);
}
return enabled_;
+#else
+ return false;
+#endif
}
// static
@@ -83,17 +91,22 @@ void TraceLog::Stop() {
}
void TraceLog::Heartbeat() {
+#ifndef ANDROID
std::string cpu = StringPrintf("%.0f", process_metrics_->GetCPUUsage());
TRACE_EVENT_INSTANT("heartbeat.cpu", 0, cpu);
+#endif
}
void TraceLog::CloseLogFile() {
+#ifndef ANDROID
if (log_file_) {
file_util::CloseFile(log_file_);
}
+#endif
}
bool TraceLog::OpenLogFile() {
+#ifndef ANDROID
FilePath::StringType pid_filename =
StringPrintf(kLogFileName, base::GetCurrentProcId());
FilePath log_file_path;
@@ -109,6 +122,9 @@ bool TraceLog::OpenLogFile() {
}
}
return true;
+#else
+ return false;
+#endif
}
void TraceLog::Trace(const std::string& name,
@@ -128,6 +144,7 @@ void TraceLog::Trace(const std::string& name,
const std::string& extra,
const char* file,
int line) {
+#ifndef ANDROID
if (!enabled_)
return;
@@ -153,12 +170,15 @@ void TraceLog::Trace(const std::string& name,
usec);
Log(msg);
+#endif
}
void TraceLog::Log(const std::string& msg) {
+#ifndef ANDROID
AutoLock lock(file_lock_);
fprintf(log_file_, "%s", msg.c_str());
+#endif
}
} // namespace base
diff --git a/base/trace_event.h b/base/trace_event.h
index ff2119a..775f628 100644
--- a/base/trace_event.h
+++ b/base/trace_event.h
@@ -131,7 +131,9 @@ class TraceLog {
FILE* log_file_;
Lock file_lock_;
TimeTicks trace_start_time_;
+#ifndef ANDROID
scoped_ptr<base::ProcessMetrics> process_metrics_;
+#endif
RepeatingTimer<TraceLog> timer_;
};
diff --git a/build/build_config.h b/build/build_config.h
index bbc8236..891ba87 100644
--- a/build/build_config.h
+++ b/build/build_config.h
@@ -60,7 +60,7 @@
// For access to standard POSIXish features, use OS_POSIX instead of a
// more specific macro.
#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
- defined(OS_OPENBSD) || defined(OS_SOLARIS)
+ defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(ANDROID)
#define OS_POSIX 1
// Use base::DataPack for name/value pairs.
#define USE_BASE_DATA_PACK 1
diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc
index 8649eb5..ec8eaf9 100644
--- a/chrome/browser/net/sqlite_persistent_cookie_store.cc
+++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc
@@ -15,8 +15,33 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/thread.h"
+#ifndef ANDROID
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/diagnostics/sqlite_diagnostics.h"
+#endif
+
+#ifdef ANDROID
+base::Thread* getDbThread()
+{
+ static base::Thread* dbThread = NULL;
+ if (dbThread && dbThread->IsRunning())
+ return dbThread;
+
+ if (!dbThread)
+ dbThread = new base::Thread("db");
+
+ if (!dbThread)
+ return NULL;
+
+ base::Thread::Options options;
+ options.message_loop_type = MessageLoop::TYPE_DEFAULT;
+ if (!dbThread->StartWithOptions(options)) {
+ delete dbThread;
+ dbThread = NULL;
+ }
+ return dbThread;
+}
+#endif
using base::Time;
@@ -123,7 +148,9 @@ void SQLitePersistentCookieStore::Backend::BatchOperation(
static const int kCommitIntervalMs = 30 * 1000;
// Commit right away if we have more than 512 outstanding operations.
static const size_t kCommitAfterBatchSize = 512;
+#ifndef ANDROID
DCHECK(!ChromeThread::CurrentlyOn(ChromeThread::DB));
+#endif
// We do a full copy of the cookie here, and hopefully just here.
scoped_ptr<PendingOperation> po(new PendingOperation(op, key, cc));
@@ -136,20 +163,37 @@ void SQLitePersistentCookieStore::Backend::BatchOperation(
num_pending = ++num_pending_;
}
+#ifdef ANDROID
+ if (!getDbThread())
+ return;
+ MessageLoop* loop = getDbThread()->message_loop();
+#endif
+
if (num_pending == 1) {
// We've gotten our first entry for this batch, fire off the timer.
+#ifdef ANDROID
+ loop->PostDelayedTask(FROM_HERE, NewRunnableMethod(
+ this, &Backend::Commit), kCommitIntervalMs);
+#else
ChromeThread::PostDelayedTask(
ChromeThread::DB, FROM_HERE,
NewRunnableMethod(this, &Backend::Commit), kCommitIntervalMs);
+#endif
} else if (num_pending == kCommitAfterBatchSize) {
// We've reached a big enough batch, fire off a commit now.
+#ifdef ANDROID
+ loop->PostTask(FROM_HERE, NewRunnableMethod(this, &Backend::Commit));
+#else
ChromeThread::PostTask(
ChromeThread::DB, FROM_HERE, NewRunnableMethod(this, &Backend::Commit));
+#endif
}
}
void SQLitePersistentCookieStore::Backend::Commit() {
+#ifndef ANDROID
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB));
+#endif
PendingOperationsList ops;
{
AutoLock locked(pending_lock_);
@@ -240,15 +284,29 @@ void SQLitePersistentCookieStore::Backend::Commit() {
// pending commit timer that will be holding a reference on us, but if/when
// this fires we will already have been cleaned up and it will be ignored.
void SQLitePersistentCookieStore::Backend::Close() {
+#ifndef ANDROID
DCHECK(!ChromeThread::CurrentlyOn(ChromeThread::DB));
+#endif
+
+#ifdef ANDROID
+ if (!getDbThread())
+ return;
+
+ MessageLoop* loop = getDbThread()->message_loop();
+ loop->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &Backend::InternalBackgroundClose));
+#else
// Must close the backend on the background thread.
ChromeThread::PostTask(
ChromeThread::DB, FROM_HERE,
NewRunnableMethod(this, &Backend::InternalBackgroundClose));
+#endif
}
void SQLitePersistentCookieStore::Backend::InternalBackgroundClose() {
+#ifndef ANDROID
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB));
+#endif
// Commit any pending operations
Commit();
@@ -315,7 +373,11 @@ bool SQLitePersistentCookieStore::Load(
return false;
}
+#ifndef ANDROID
+ // GetErrorHandlerForCookieDb is defined in sqlite_diagnostics.h
+ // which we do not currently include on Android
db->set_error_delegate(GetErrorHandlerForCookieDb());
+#endif
if (!EnsureDatabaseVersion(db.get()) || !InitTable(db.get())) {
NOTREACHED() << "Unable to initialize cookie DB.";
diff --git a/net/base/address_list.cc b/net/base/address_list.cc
index 1c97311..0fbf38a 100644
--- a/net/base/address_list.cc
+++ b/net/base/address_list.cc
@@ -4,6 +4,7 @@
#include "net/base/address_list.h"
+#include <netinet/in.h>
#include <stdlib.h>
#include "base/logging.h"
diff --git a/net/base/bandwidth_metrics.h b/net/base/bandwidth_metrics.h
index c290ca9..2396157 100644
--- a/net/base/bandwidth_metrics.h
+++ b/net/base/bandwidth_metrics.h
@@ -95,7 +95,9 @@ class BandwidthMetrics {
LOG(INFO) << "Bandwidth: " << kbps
<< "Kbps (avg " << bandwidth() << "Kbps)";
int kbps_int = static_cast<int>(kbps);
+#ifndef ANDROID
UMA_HISTOGRAM_COUNTS_10000("Net.DownloadBandwidth", kbps_int);
+#endif
}
}
}
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc
index ba91db2..6b2656a 100644
--- a/net/base/file_stream_posix.cc
+++ b/net/base/file_stream_posix.cc
@@ -26,7 +26,9 @@
#include "net/base/net_errors.h"
// We cast back and forth, so make sure it's the size we're expecting.
-COMPILE_ASSERT(sizeof(int64) == sizeof(off_t), off_t_64_bit);
+//COMPILE_ASSERT(sizeof(int64) == sizeof(off_t), off_t_64_bit);
+COMPILE_ASSERT(sizeof(int32) == sizeof(off_t), off_t_32_bit);
+// I don't tink this will be a problem for now
// Make sure our Whence mappings match the system headers.
COMPILE_ASSERT(net::FROM_BEGIN == SEEK_SET &&
diff --git a/net/base/gzip_filter.cc b/net/base/gzip_filter.cc
index f1920da..cce597a 100644
--- a/net/base/gzip_filter.cc
+++ b/net/base/gzip_filter.cc
@@ -16,6 +16,11 @@
#define MOZ_Z_inflateInit_ inflateInit_
#define MOZ_Z_inflateReset inflateReset
#else
+#define MOZ_Z_inflate inflate
+#define MOZ_Z_inflateEnd inflateEnd
+#define MOZ_Z_inflateInit2_ inflateInit2_
+#define MOZ_Z_inflateInit_ inflateInit_
+#define MOZ_Z_inflateReset inflateReset
#include "third_party/zlib/zlib.h"
#endif
diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc
index 320406c..82a5f7e 100644
--- a/net/base/host_resolver.cc
+++ b/net/base/host_resolver.cc
@@ -35,8 +35,13 @@ int SingleRequestHostResolver::Resolve(const HostResolver::RequestInfo& info,
// we can clear out |cur_request_*|.
CompletionCallback* transient_callback = callback ? &callback_ : NULL;
+#ifdef ANDROID
+ HostResolver* hr = CreateSystemHostResolver(NULL);
+ int rv = hr->Resolve(info, addresses, transient_callback, &request, net_log);
+#else
int rv = resolver_->Resolve(
info, addresses, transient_callback, &request, net_log);
+#endif
if (rv == ERR_IO_PENDING) {
// Cleared in OnResolveCompletion().
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index ffba57f..c06e065 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -49,22 +49,34 @@ HostCache* CreateDefaultCache() {
return cache;
}
+HostResolver* systemResolver = NULL;
} // anonymous namespace
HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves) {
// Maximum of 50 concurrent threads.
// TODO(eroman): Adjust this, do some A/B experiments.
+#ifdef ANDROID
+ static const size_t kDefaultMaxJobs = 4u;
+#else
static const size_t kDefaultMaxJobs = 50u;
+#endif
if (max_concurrent_resolves == HostResolver::kDefaultParallelism)
max_concurrent_resolves = kDefaultMaxJobs;
+#ifdef ANDROID
+ // TODO: Clean this up!
+ if (!systemResolver)
+ systemResolver = new HostResolverImpl(
+ NULL, CreateDefaultCache(), max_concurrent_resolves);
+#else
HostResolverImpl* resolver =
new HostResolverImpl(NULL, CreateDefaultCache(),
max_concurrent_resolves);
+#endif
- return resolver;
+ return systemResolver;
}
static int ResolveAddrInfo(HostResolverProc* resolver_proc,
@@ -133,7 +145,10 @@ class HostResolveFailedParams : public NetLog::EventParameters {
std::vector<int> GetAllGetAddrinfoOSErrors() {
int os_errors[] = {
#if defined(OS_POSIX)
+#ifndef ANDROID
+ // "obsoleted ..." see bionic/libc/include/netdb.h
EAI_ADDRFAMILY,
+#endif
EAI_AGAIN,
EAI_BADFLAGS,
EAI_FAIL,
diff --git a/net/base/host_resolver_proc.cc b/net/base/host_resolver_proc.cc
index 804135c..39bd808 100644
--- a/net/base/host_resolver_proc.cc
+++ b/net/base/host_resolver_proc.cc
@@ -10,6 +10,8 @@
#include <resolv.h>
#endif
+#include <netinet/in.h>
+
#include "base/logging.h"
#include "base/time.h"
#include "net/base/address_list.h"
@@ -223,7 +225,7 @@ int SystemHostResolverProc(const std::string& host,
hints.ai_socktype = SOCK_STREAM;
int err = getaddrinfo(host.c_str(), NULL, &hints, &ai);
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(ANDROID)
net::DnsReloadTimer* dns_timer = Singleton<net::DnsReloadTimer>::get();
// If we fail, re-initialise the resolver just in case there have been any
// changes to /etc/resolv.conf and retry. See http://crbug.com/11380 for info.
diff --git a/net/base/https_prober.h b/net/base/https_prober.h
index 327fc16..952176b 100644
--- a/net/base/https_prober.h
+++ b/net/base/https_prober.h
@@ -23,6 +23,7 @@ namespace net {
class HTTPSProberDelegate {
public:
virtual void ProbeComplete(bool result) = 0;
+ virtual ~HTTPSProberDelegate() {};
};
// HTTPSProber is a singleton object that manages HTTPS probes. A HTTPS probe
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 5863b68..9163eeb 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -163,8 +163,10 @@ bool MimeUtil::GetMimeTypeFromExtension(const FilePath::StringType& ext,
return true;
}
+#ifndef ANDROID
if (GetPlatformMimeTypeFromExtension(ext, result))
return true;
+#endif
mime_type = FindMimeType(secondary_mappings, arraysize(secondary_mappings),
ext_narrow_str.c_str());
@@ -480,7 +482,11 @@ bool GetMimeTypeFromFile(const FilePath& file_path, std::string* mime_type) {
bool GetPreferredExtensionForMimeType(const std::string& mime_type,
FilePath::StringType* extension) {
+#ifdef ANDROID
+ return false;
+#else
return GetMimeUtil()->GetPreferredExtensionForMimeType(mime_type, extension);
+#endif
}
bool IsSupportedImageMimeType(const char* mime_type) {
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index c7b6a6f..4accc49 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -22,7 +22,9 @@
#include <wspiapi.h> // Needed for Win2k compat.
#elif defined(OS_POSIX)
#include <fcntl.h>
+#ifndef ANDROID
#include <ifaddrs.h>
+#endif
#include <netdb.h>
#include <net/if.h>
#include <netinet/in.h>
@@ -65,6 +67,10 @@
#include "unicode/datefmt.h"
+#ifdef ANDROID
+#include "netinet/in6.h"
+#endif
+
using base::Time;
namespace {
@@ -1682,7 +1688,10 @@ static void IPv6SupportResults(IPv6SupportStatus result) {
// to do a test resolution, and a test connection, to REALLY verify support.
// static
bool IPv6Supported() {
-#if defined(OS_POSIX)
+#ifdef ANDROID
+ // Android does not have the ifaddrs.h header
+ return false;
+#elif defined(OS_POSIX)
int test_socket = socket(AF_INET6, SOCK_STREAM, 0);
if (test_socket == -1) {
IPv6SupportResults(IPV6_CANNOT_CREATE_SOCKETS);
diff --git a/net/base/sdch_filter.cc b/net/base/sdch_filter.cc
index 725ee3e..0ab4381 100644
--- a/net/base/sdch_filter.cc
+++ b/net/base/sdch_filter.cc
@@ -33,6 +33,7 @@ SdchFilter::SdchFilter(const FilterContext& filter_context)
}
SdchFilter::~SdchFilter() {
+#ifndef ANDROID
// All code here is for gathering stats, and can be removed when SDCH is
// considered stable.
@@ -110,6 +111,7 @@ SdchFilter::~SdchFilter() {
return;
}
} // end of switch.
+#endif
}
bool SdchFilter::InitDecoding(Filter::FilterType filter_type) {
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index 6a8709b..0957382 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -32,7 +32,7 @@ SdchManager* SdchManager::Global() {
// static
void SdchManager::SdchErrorRecovery(ProblemCodes problem) {
- UMA_HISTOGRAM_ENUMERATION("Sdch3.ProblemCodes_4", problem, MAX_PROBLEM_CODE);
+// UMA_HISTOGRAM_ENUMERATION("Sdch3.ProblemCodes_4", problem, MAX_PROBLEM_CODE);
}
// static
@@ -269,7 +269,7 @@ bool SdchManager::AddSdchDictionary(const std::string& dictionary_text,
return false;
}
- UMA_HISTOGRAM_COUNTS("Sdch3.Dictionary size loaded", dictionary_text.size());
+// UMA_HISTOGRAM_COUNTS("Sdch3.Dictionary size loaded", dictionary_text.size());
DLOG(INFO) << "Loaded dictionary with client hash " << client_hash <<
" and server hash " << server_hash;
Dictionary* dictionary =
@@ -309,8 +309,8 @@ void SdchManager::GetAvailDictionaryList(const GURL& target_url,
list->append(it->second->client_hash());
}
// Watch to see if we have corrupt or numerous dictionaries.
- if (count > 0)
- UMA_HISTOGRAM_COUNTS("Sdch3.Advertisement_Count", count);
+// if (count > 0)
+// UMA_HISTOGRAM_COUNTS("Sdch3.Advertisement_Count", count);
}
SdchManager::Dictionary::Dictionary(const std::string& dictionary_text,
diff --git a/net/base/upload_data_stream.cc b/net/base/upload_data_stream.cc
index 140aa8a..bc38e1b 100644
--- a/net/base/upload_data_stream.cc
+++ b/net/base/upload_data_stream.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
+
#include "net/base/upload_data_stream.h"
#include "base/file_util.h"
diff --git a/net/base/x509_certificate.cc b/net/base/x509_certificate.cc
index f5b28a6..7f607ea 100644
--- a/net/base/x509_certificate.cc
+++ b/net/base/x509_certificate.cc
@@ -53,6 +53,9 @@ bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a,
#elif defined(USE_NSS)
return a->derCert.len == b->derCert.len &&
memcmp(a->derCert.data, b->derCert.data, a->derCert.len) == 0;
+#elif defined(USE_OPENSSL)
+ // ANDROID needs this but doesn't have UNREACHED()
+ return false;
#else
// TODO(snej): not implemented
UNREACHED();
diff --git a/net/base/x509_certificate.h b/net/base/x509_certificate.h
index d6b3447..4d65919 100644
--- a/net/base/x509_certificate.h
+++ b/net/base/x509_certificate.h
@@ -24,6 +24,9 @@
#elif defined(USE_NSS)
// Forward declaration; real one in <cert.h>
struct CERTCertificateStr;
+#elif defined(USE_OPENSSL)
+// real dec in x509.h
+struct x509_st;
#endif
class Pickle;
@@ -44,6 +47,8 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> {
typedef SecCertificateRef OSCertHandle;
#elif defined(USE_NSS)
typedef struct CERTCertificateStr* OSCertHandle;
+#elif defined(USE_OPENSSL)
+ typedef struct x509_st* OSCertHandle;
#else
// TODO(ericroman): not implemented
typedef void* OSCertHandle;
diff --git a/net/base/x509_certificate_openssl.cc b/net/base/x509_certificate_openssl.cc
new file mode 100644
index 0000000..2e2baf0
--- /dev/null
+++ b/net/base/x509_certificate_openssl.cc
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "net/base/x509_certificate.h"
+
+#include "openssl/x509.h"
+
+namespace net {
+
+X509Certificate::OSCertHandle X509Certificate::DupOSCertHandle(
+ OSCertHandle cert_handle) {
+ return NULL;
+}
+
+void X509Certificate::FreeOSCertHandle(OSCertHandle cert) {
+}
+
+void X509Certificate::Initialize() {
+}
+
+SHA1Fingerprint X509Certificate::CalculateFingerprint(
+ OSCertHandle cert) {
+ SHA1Fingerprint sha1;
+ memcpy(sha1.data, cert->sha1_hash, 20);
+ return sha1;
+}
+
+X509Certificate::OSCertHandle X509Certificate::CreateOSCertHandleFromBytes(
+ char const*, int) {
+ return NULL;
+}
+
+X509Certificate* X509Certificate::CreateFromPickle(const Pickle& pickle,
+ void** pickle_iter) {
+ return NULL;
+}
+
+void X509Certificate::Persist(Pickle* pickle) {
+}
+
+
+} // namespace net
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 13b17f4..84f023d 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -1257,7 +1257,11 @@ void BackendImpl::AdjustMaxCacheSize(int table_len) {
DCHECK(!table_len || data_->header.magic);
// The user is not setting the size, let's figure it out.
+#ifdef ANDROID
+ int64 available = 10 * 1024 * 1024; // 10 MB
+#else
int64 available = base::SysInfo::AmountOfFreeDiskSpace(path_);
+#endif
if (available < 0) {
max_size_ = kDefaultCacheSize;
return;
diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc
index 295f744..38834a6 100644
--- a/net/disk_cache/file_posix.cc
+++ b/net/disk_cache/file_posix.cc
@@ -307,7 +307,12 @@ bool File::Write(const void* buffer, size_t buffer_len, size_t offset) {
if (buffer_len > ULONG_MAX || offset > ULONG_MAX)
return false;
+#ifdef ANDROID
+ int ret = pwrite(platform_file_, const_cast<void*>(buffer), buffer_len, offset);
+#else
int ret = pwrite(platform_file_, buffer, buffer_len, offset);
+#endif
+
return (static_cast<size_t>(ret) == buffer_len);
}
diff --git a/net/disk_cache/mem_backend_impl.cc b/net/disk_cache/mem_backend_impl.cc
index fe57d7d..b5064b2 100644
--- a/net/disk_cache/mem_backend_impl.cc
+++ b/net/disk_cache/mem_backend_impl.cc
@@ -41,6 +41,7 @@ Backend* MemBackendImpl::CreateBackend(int max_bytes) {
}
bool MemBackendImpl::Init() {
+#ifndef ANDROID
if (max_size_)
return true;
@@ -58,7 +59,9 @@ bool MemBackendImpl::Init() {
max_size_ = kDefaultCacheSize * 5;
else
max_size_ = static_cast<int32>(total_memory);
-
+#else
+ max_size_ = kDefaultCacheSize*3;
+#endif
return true;
}
diff --git a/net/flip/flip_framer.cc b/net/flip/flip_framer.cc
index f200ac6..b165a33 100644
--- a/net/flip/flip_framer.cc
+++ b/net/flip/flip_framer.cc
@@ -636,8 +636,10 @@ FlipFrame* FlipFramer::CompressFrame(const FlipFrame* frame) {
int header_length;
const char* payload;
+#ifndef ANDROID
static StatsCounter pre_compress_bytes("flip.PreCompressSize");
static StatsCounter post_compress_bytes("flip.PostCompressSize");
+#endif
if (!enable_compression_)
return DuplicateFrame(frame);
@@ -678,8 +680,10 @@ FlipFrame* FlipFramer::CompressFrame(const FlipFrame* frame) {
int compressed_size = compressed_max_size - compressor_->avail_out;
new_frame->set_length(header_length + compressed_size - FlipFrame::size());
+#ifndef ANDROID
pre_compress_bytes.Add(payload_length);
post_compress_bytes.Add(new_frame->length());
+#endif
return new_frame;
}
@@ -689,8 +693,10 @@ FlipFrame* FlipFramer::DecompressFrame(const FlipFrame* frame) {
int header_length;
const char* payload;
+#ifndef ANDROID
static StatsCounter pre_decompress_bytes("flip.PreDeCompressSize");
static StatsCounter post_decompress_bytes("flip.PostDeCompressSize");
+#endif
if (!enable_compression_)
return DuplicateFrame(frame);
@@ -747,8 +753,10 @@ FlipFrame* FlipFramer::DecompressFrame(const FlipFrame* frame) {
int decompressed_size = decompressed_max_size - decompressor_->avail_out;
new_frame->set_length(header_length + decompressed_size - FlipFrame::size());
+#ifndef ANDROID
pre_decompress_bytes.Add(frame->length());
post_decompress_bytes.Add(new_frame->length());
+#endif
return new_frame;
}
diff --git a/net/flip/flip_network_transaction.cc b/net/flip/flip_network_transaction.cc
index 440e666..e234b33 100644
--- a/net/flip/flip_network_transaction.cc
+++ b/net/flip/flip_network_transaction.cc
@@ -48,7 +48,10 @@ int FlipNetworkTransaction::Start(const HttpRequestInfo* request_info,
CHECK(request_info);
CHECK(callback);
+// missing flockf
+#ifndef ANDROID
SIMPLE_STATS_COUNTER("FlipNetworkTransaction.Count");
+#endif
load_log_ = load_log;
request_ = request_info;
diff --git a/net/flip/flip_session.cc b/net/flip/flip_session.cc
index d91c37c..7cf7b2a 100644
--- a/net/flip/flip_session.cc
+++ b/net/flip/flip_session.cc
@@ -237,6 +237,7 @@ FlipSession::~FlipSession() {
DCHECK(!session_->flip_session_pool()->HasSession(
HostResolver::RequestInfo(domain_, 80)));
+#ifndef ANDROID
// Record per-session histograms here.
UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsPerSession",
streams_initiated_count_,
@@ -250,11 +251,14 @@ FlipSession::~FlipSession() {
UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamsAbandonedPerSession",
streams_abandoned_count_,
0, 300, 50);
+#endif
}
void FlipSession::InitializeWithSocket(ClientSocketHandle* connection) {
+#ifndef ANDROID
static StatsCounter flip_sessions("flip.sessions");
flip_sessions.Increment();
+#endif
AdjustSocketBufferSizes(connection->socket());
@@ -279,8 +283,10 @@ net::Error FlipSession::Connect(const std::string& group_name,
state_ = CONNECTING;
+#ifndef ANDROID
static StatsCounter flip_sessions("flip.sessions");
flip_sessions.Increment();
+#endif
int rv = connection_->Init(group_name, host, priority, &connect_callback_,
session_->tcp_socket_pool(), load_log);
@@ -334,8 +340,10 @@ scoped_refptr<FlipStream> FlipSession::GetOrCreateStream(
stream->set_path(path);
ActivateStream(stream);
+#ifndef ANDROID
UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyPriorityCount",
static_cast<int>(request.priority), 0, 10, 11);
+#endif
LOG(INFO) << "FlipStream: Creating stream " << stream_id << " for " << url;
@@ -360,8 +368,10 @@ scoped_refptr<FlipStream> FlipSession::GetOrCreateStream(
memcpy(buffer->data(), syn_frame->data(), length);
queue_.push(FlipIOBuffer(buffer, length, request.priority, stream));
+#ifndef ANDROID
static StatsCounter flip_requests("flip.requests");
flip_requests.Increment();
+#endif
LOG(INFO) << "FETCHING: " << request.url.spec();
streams_initiated_count_++;
@@ -465,7 +475,9 @@ void FlipSession::OnTCPConnect(int result) {
// socket (or have an error trying to do so).
DCHECK(!connection_->socket() || !connection_->is_reused());
+#ifndef ANDROID
UpdateConnectionTypeHistograms(CONNECTION_SPDY, result >= 0);
+#endif
if (result != net::OK) {
DCHECK_LT(result, 0);
@@ -720,11 +732,15 @@ void FlipSession::WriteSocket() {
void FlipSession::CloseAllStreams(net::Error code) {
LOG(INFO) << "Closing all FLIP Streams";
+#ifndef ANDROID
static StatsCounter abandoned_streams("flip.abandoned_streams");
static StatsCounter abandoned_push_streams("flip.abandoned_push_streams");
+#endif
if (active_streams_.size()) {
+#ifndef ANDROID
abandoned_streams.Add(active_streams_.size());
+#endif
// Create a copy of the list, since aborting streams can invalidate
// our list.
@@ -749,7 +765,9 @@ void FlipSession::CloseAllStreams(net::Error code) {
if (pushed_streams_.size()) {
streams_abandoned_count_ += pushed_streams_.size();
+#ifndef ANDROID
abandoned_push_streams.Add(pushed_streams_.size());
+#endif
pushed_streams_.clear();
}
}
@@ -801,7 +819,9 @@ void FlipSession::DeactivateStream(flip::FlipStreamId id) {
}
scoped_refptr<FlipStream> FlipSession::GetPushStream(const std::string& path) {
+#ifndef ANDROID
static StatsCounter used_push_streams("flip.claimed_push_streams");
+#endif
LOG(INFO) << "Looking for push stream: " << path;
@@ -814,7 +834,9 @@ scoped_refptr<FlipStream> FlipSession::GetPushStream(const std::string& path) {
if (path == stream->path()) {
CHECK(stream->pushed());
pushed_streams_.erase(it);
+#ifndef ANDROID
used_push_streams.Increment();
+#endif
LOG(INFO) << "Push Stream Claim for: " << path;
break;
}
@@ -931,8 +953,10 @@ void FlipSession::OnSyn(const flip::FlipSynStreamControlFrame* frame,
LOG(INFO) << "Got pushed stream for " << stream->path();
+#ifndef ANDROID
static StatsCounter push_requests("flip.pushed_streams");
push_requests.Increment();
+#endif
}
void FlipSession::OnSynReply(const flip::FlipSynReplyControlFrame* frame,
diff --git a/net/flip/flip_stream.cc b/net/flip/flip_stream.cc
index b3d0978..5b18c54 100755
--- a/net/flip/flip_stream.cc
+++ b/net/flip/flip_stream.cc
@@ -421,6 +421,7 @@ void FlipStream::UpdateHistograms() {
recv_last_byte_time_.is_null())
return;
+#ifndef ANDROID
UMA_HISTOGRAM_TIMES("Net.SpdyStreamTimeToFirstByte",
recv_first_byte_time_ - send_time_);
UMA_HISTOGRAM_TIMES("Net.SpdyStreamDownloadTime",
@@ -430,6 +431,7 @@ void FlipStream::UpdateHistograms() {
UMA_HISTOGRAM_COUNTS("Net.SpdySendBytes", send_bytes_);
UMA_HISTOGRAM_COUNTS("Net.SpdyRecvBytes", recv_bytes_);
+#endif
}
} // namespace net
diff --git a/net/http/des.cc b/net/http/des.cc
index 0ca12b9..a611f51 100644
--- a/net/http/des.cc
+++ b/net/http/des.cc
@@ -215,6 +215,14 @@ void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
CryptReleaseContext(provider, 0);
}
+#elif defined(USE_OPENSSL)
+
+// To be implemented with openssl
+void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
+ int* a = NULL;
+ int c = *a;
+}
+
#endif
} // namespace net
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index 2ea08b8..9bbf4d1 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -1868,7 +1868,7 @@ void HttpCache::Transaction::HistogramHeaders(
// |value| goes from 0 to 63. Actually, the max value should be 47 (0x2f)
// but we'll see.
- UMA_HISTOGRAM_ENUMERATION("HttpCache.ResponseHeaders", value, 65);
+// UMA_HISTOGRAM_ENUMERATION("HttpCache.ResponseHeaders", value, 65);
}
void HttpCache::Transaction::OnIOComplete(int result) {
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index a85a1ca..6783a0a 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -1621,6 +1621,10 @@ void HttpNetworkTransaction::ResetConnectionAndRequestForResend() {
}
int HttpNetworkTransaction::ReconsiderProxyAfterError(int error) {
+#ifdef ANDROID
+ // Android crashes :(
+ return error;
+#endif
DCHECK(!pac_request_);
// A failure to resolve the hostname or any error related to establishing a
diff --git a/net/proxy/proxy_config_service_linux.h b/net/proxy/proxy_config_service_linux.h
index c6e9c90..44ea4de 100644
--- a/net/proxy/proxy_config_service_linux.h
+++ b/net/proxy/proxy_config_service_linux.h
@@ -222,8 +222,10 @@ class ProxyConfigServiceLinux : public ProxyConfigService {
void SetupAndFetchInitialConfig(MessageLoop* glib_default_loop,
MessageLoop* io_loop,
MessageLoopForIO* file_loop) {
+#ifndef ANDROID
delegate_->SetupAndFetchInitialConfig(glib_default_loop, io_loop,
file_loop);
+#endif
}
void OnCheckProxyConfigSettings() {
delegate_->OnCheckProxyConfigSettings();
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 8f9d28c..33af9c6 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -587,7 +587,7 @@ ProxyConfigService* ProxyService::CreateSystemProxyConfigService(
return new ProxyConfigServiceWin();
#elif defined(OS_MACOSX)
return new ProxyConfigServiceMac();
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) && !defined(ANDROID)
ProxyConfigServiceLinux* linux_config_service
= new ProxyConfigServiceLinux();
diff --git a/net/socket/client_socket_factory.cc b/net/socket/client_socket_factory.cc
index fbccfcb..622bccd 100644
--- a/net/socket/client_socket_factory.cc
+++ b/net/socket/client_socket_factory.cc
@@ -11,6 +11,8 @@
#include "net/socket/ssl_client_socket_win.h"
#elif defined(USE_NSS)
#include "net/socket/ssl_client_socket_nss.h"
+#elif defined(USE_OPENSSL)
+#include "net/socket/ssl_client_socket_openssl.h"
#elif defined(OS_MACOSX)
#include "net/socket/ssl_client_socket_mac.h"
#include "net/socket/ssl_client_socket_nss.h"
@@ -29,6 +31,8 @@ SSLClientSocket* DefaultSSLClientSocketFactory(
return new SSLClientSocketWin(transport_socket, hostname, ssl_config);
#elif defined(USE_NSS)
return new SSLClientSocketNSS(transport_socket, hostname, ssl_config);
+#elif defined(USE_OPENSSL)
+ return new SSLClientSocketOpenSSL(transport_socket, hostname, ssl_config);
#elif defined(OS_MACOSX)
// TODO(wtc): SSLClientSocketNSS can't do SSL client authentication using
// Mac OS X CDSA/CSSM yet (http://crbug.com/45369), so fall back on
diff --git a/net/socket/socks5_client_socket.cc b/net/socket/socks5_client_socket.cc
index 997fb25..392483d 100644
--- a/net/socket/socks5_client_socket.cc
+++ b/net/socket/socks5_client_socket.cc
@@ -4,6 +4,8 @@
#include "net/socket/socks5_client_socket.h"
+#include <netinet/in.h>
+
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/format_macros.h"
diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc
index 32c4e3b..0af80b4 100644
--- a/net/socket/socks_client_socket.cc
+++ b/net/socket/socks_client_socket.cc
@@ -4,6 +4,8 @@
#include "net/socket/socks_client_socket.h"
+#include <netinet/in.h>
+
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/trace_event.h"
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc
new file mode 100644
index 0000000..1ec5753
--- /dev/null
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -0,0 +1,522 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#include "net/socket/ssl_client_socket_openssl.h"
+
+#include "net/base/net_errors.h"
+#include "openssl/err.h"
+
+namespace net {
+
+#if 1
+#define GotoState(s) next_handshake_state_ = s
+#else
+#define GotoState(s) do { LOG(INFO) << (void *)this << " " << __FUNCTION__ << \
+ " jump to state " << s; \
+ next_handshake_state_ = s; } while (0)
+#endif
+
+
+bool SSLClientSocketOpenSSL::InitOpenSSL() {
+ if(ctx) {
+ return true;
+ }
+
+ SSL_load_error_strings();
+ if (!SSL_library_init())
+ return false;
+
+ const SSL_METHOD *pMethod = SSLv23_client_method();
+ ctx = SSL_CTX_new(pMethod);
+
+ if (!ctx) {
+ return false;
+ }
+
+ SSL_CTX_set_verify(ctx, /*SSL_VERIFY_PEER*/ SSL_VERIFY_NONE, NULL/*callback*/); //void
+
+ return true;
+}
+
+// Add some error checking ...
+bool SSLClientSocketOpenSSL::Init() {
+ if (!ctx) {
+ return false;
+ }
+
+ ssl = SSL_new(ctx);
+
+ bio_read = BIO_new(BIO_s_mem());
+ bio_write = BIO_new(BIO_s_mem());
+
+ write_buf_size = 1024; // Why does this not work? BIO_get_write_buf_size(bio_write, 1000);
+
+ if (!SSL_set_tlsext_host_name(ssl, hostname_.c_str()))
+ return false;
+
+ SSL_set_bio(ssl, bio_read, bio_write); // void
+
+ // Connect as client
+ SSL_set_connect_state(ssl); // void
+
+ return true;
+}
+
+SSL_CTX* SSLClientSocketOpenSSL::ctx = NULL;
+
+SSLClientSocketOpenSSL::SSLClientSocketOpenSSL(ClientSocketHandle* transport_socket,
+ const std::string& hostname,
+ const SSLConfig& ssl_config)
+ : transport_send_busy_(false),
+ transport_recv_busy_(false),
+ user_connect_callback_(NULL),
+ user_read_callback_(NULL),
+ user_write_callback_(NULL),
+ client_auth_cert_needed_(false),
+ transport_(transport_socket),
+ hostname_(hostname),
+ ssl_config_(ssl_config),
+ completed_handshake_(false),
+ net_log_(transport_socket->socket()->NetLog()) {
+ buffer_send_callback_ = new CompletionCallbackImpl<SSLClientSocketOpenSSL>(
+ this, &SSLClientSocketOpenSSL::BufferSendComplete);
+ buffer_recv_callback_ = new CompletionCallbackImpl<SSLClientSocketOpenSSL>(
+ this, &SSLClientSocketOpenSSL::BufferRecvComplete);
+}
+
+SSLClientSocketOpenSSL::~SSLClientSocketOpenSSL() {
+ delete buffer_send_callback_;
+ delete buffer_recv_callback_;
+
+ Disconnect();
+}
+
+
+// SSLClientSocket methods
+
+void SSLClientSocketOpenSSL::GetSSLInfo(SSLInfo* ssl_info) {
+}
+
+void SSLClientSocketOpenSSL::GetSSLCertRequestInfo(
+ SSLCertRequestInfo* cert_request_info) {
+}
+
+SSLClientSocket::NextProtoStatus
+SSLClientSocketOpenSSL::GetNextProto(std::string* proto) {
+ return kNextProtoUnsupported;
+}
+
+void SSLClientSocketOpenSSL::DoReadCallback(int rv) {
+ // Since Run may result in Read being called, clear |user_read_callback_|
+ // up front.
+ CompletionCallback* c = user_read_callback_;
+ user_read_callback_ = NULL;
+ user_read_buf_ = NULL;
+ user_read_buf_len_ = 0;
+ c->Run(rv);
+}
+
+void SSLClientSocketOpenSSL::DoWriteCallback(int rv) {
+ // Since Run may result in Write being called, clear |user_write_callback_|
+ // up front.
+ CompletionCallback* c = user_write_callback_;
+ user_write_callback_ = NULL;
+ user_write_buf_ = NULL;
+ user_write_buf_len_ = 0;
+ c->Run(rv);
+}
+
+// ClientSocket methods
+
+// Should make a proper return error
+// and call the callback with more info
+int SSLClientSocketOpenSSL::Connect(CompletionCallback* callback) {
+ if(!InitOpenSSL()) {
+ return -1; // Anything but OK signals error
+ }
+
+ // Set up new ssl object
+ if(!Init()) {
+ return -1;
+ }
+
+ // Handshake happens here
+ int err = SSL_connect(ssl);
+
+ GotoState(STATE_HANDSHAKE);
+ int rv = DoHandshakeLoop(net::OK);
+ if (rv == ERR_IO_PENDING) {
+ user_connect_callback_ = callback;
+ }
+
+ // (Optional) Tell loadlog we are starting and store a ref
+ return rv > OK ? OK : rv;
+}
+
+void SSLClientSocketOpenSSL::Disconnect() {
+ // Null all callbacks
+ // Delete all buffers
+ // Handshake not completed anymore
+ //verifier_.reset();
+ completed_handshake_ = false;
+ transport_->socket()->Disconnect();
+}
+
+int SSLClientSocketOpenSSL::DoHandshakeLoop(int last_io_result) {
+ bool network_moved;
+ int rv = last_io_result;
+ do {
+ // Default to STATE_NONE for next state.
+ // (This is a quirk carried over from the windows
+ // implementation. It makes reading the logs a bit harder.)
+ // State handlers can and often do call GotoState just
+ // to stay in the current state.
+ State state = next_handshake_state_;
+ GotoState(STATE_NONE);
+ switch (state) {
+ case STATE_NONE:
+ // we're just pumping data between the buffer and the network
+ break;
+ case STATE_HANDSHAKE:
+ rv = DoHandshake();
+ break;
+ case STATE_VERIFY_CERT:
+// DCHECK(rv == OK);
+// rv = DoVerifyCert(rv);
+// break;
+ case STATE_VERIFY_CERT_COMPLETE:
+// rv = DoVerifyCertComplete(rv);
+// break;
+ default:
+// rv = ERR_UNEXPECTED;
+// NOTREACHED() << "unexpected state";
+ break;
+ }
+
+ // To avoid getting an ERR_IO_PENDING here after handshake complete.
+ if (next_handshake_state_ == STATE_NONE)
+ break;
+
+ // Do the actual network I/O
+ network_moved = DoTransportIO();
+ } while ((rv != ERR_IO_PENDING || network_moved) &&
+ next_handshake_state_ != STATE_NONE);
+ return rv;
+}
+
+int SSLClientSocketOpenSSL::DoHandshake() {
+ int rv = SSL_do_handshake(ssl);
+
+ if (rv == 1) {
+ // SSL handshake is completed. Let's verify the certificate.
+ // For now we are done, certificates not implemented yet
+ // TODO: Implement certificates
+ rv = OK;
+ GotoState(STATE_NONE);
+ completed_handshake_ = true;
+ } else {
+ int ssl_error = SSL_get_error(ssl, rv);
+
+ // If not done, stay in this state
+ if (ssl_error == SSL_ERROR_WANT_READ) {
+ rv = ERR_IO_PENDING;
+ GotoState(STATE_HANDSHAKE);
+ } else if (ssl_error == SSL_ERROR_WANT_WRITE) {
+ rv = ERR_IO_PENDING;
+ GotoState(STATE_HANDSHAKE);
+ } else {
+ GotoState(STATE_HANDSHAKE);
+ }
+ }
+
+ return rv;
+}
+
+bool SSLClientSocketOpenSSL::DoTransportIO() {
+ bool network_moved = false;
+ int nsent = BufferSend();
+ int nreceived = BufferRecv();
+ network_moved = (nsent > 0 || nreceived >= 0);
+
+ return network_moved;
+}
+
+int SSLClientSocketOpenSSL::BufferSend(void) {
+ size_t data_pending = BIO_ctrl_pending(bio_write);
+ if (data_pending == 0) {
+ return NULL;
+ }
+
+ scoped_refptr<IOBuffer> send_buffer = new IOBuffer(data_pending);
+ int bytes_read = BIO_read(bio_write, send_buffer->data(), data_pending);
+
+ if (bytes_read > 0) {
+ int rv;
+ do {
+ rv = transport_->socket()->Write(send_buffer, data_pending, buffer_send_callback_);
+ if (rv == ERR_IO_PENDING) {
+ transport_send_busy_ = true;
+ break; // will get callback
+ } else if (rv < 0) {
+ // just resend and pray
+ //android_printLog(ANDROID_LOG_ERROR, "https", "transport->write returned %d", rv);
+ } else if (rv != bytes_read) { // TODO: what to do about the rest of data read from openssl?
+ //android_printLog(ANDROID_LOG_ERROR, "https", "Only sent %d out of %d bytes", rv, bytes_read);
+ }
+ } while (rv < ERR_IO_PENDING); // -1
+ return rv;
+ } else {
+ int err = SSL_get_error(ssl, bytes_read);
+ //android_printLog(ANDROID_LOG_DEBUG, "https", "SSL error in BufferSend: %d / %d (%d)", err, bytes_read, data_pending);
+ return 0;
+ }
+}
+
+void SSLClientSocketOpenSSL::BufferSendComplete(int result) {
+ transport_send_busy_ = false;
+ OnSendComplete(result);
+}
+
+int SSLClientSocketOpenSSL::BufferRecv(void) {
+ if (transport_recv_busy_)
+ return ERR_IO_PENDING;
+
+ int max_write = write_buf_size;
+// Why does this not work?
+// int max_write = BIO_ctrl_get_write_guarantee(bio_read);
+// int mw = BIO_ctrl_get_write_guarantee(bio_write);
+// android_printLog(ANDROID_LOG_DEBUG, "https", "BufferRecv can write at most %d", max_write);
+
+ int rv;
+ if (!max_write) {
+ rv = ERR_IO_PENDING;
+ } else {
+ recv_buffer_ = new IOBuffer(max_write);
+ rv = transport_->socket()->Read(recv_buffer_, max_write, buffer_recv_callback_);
+ if (rv == ERR_IO_PENDING) {
+ transport_recv_busy_ = true;
+ } else {
+ if (rv > 0) {
+ int ret = BIO_write(bio_read, recv_buffer_->data(), rv);
+ if (ret != rv) {
+ //android_printLog(ANDROID_LOG_ERROR, "https", "wrote less than capacity, should not happen (%d > %d : %d)", rv, ret, max_write);
+ }
+ }
+ recv_buffer_ = NULL;
+ }
+ }
+ return rv;
+}
+
+void SSLClientSocketOpenSSL::BufferRecvComplete(int result) {
+ if (result > 0) {
+ int ret = BIO_write(bio_read, recv_buffer_->data(), result);
+ if (ret != result) {
+ //android_printLog(ANDROID_LOG_ERROR, "https", "BIO_write returned: %d (not %d)", ret, result);
+ }
+ }
+ recv_buffer_ = NULL;
+ transport_recv_busy_ = false;
+ OnRecvComplete(result);
+}
+
+void SSLClientSocketOpenSSL::DoConnectCallback(int rv) {
+ CompletionCallback* c = user_connect_callback_;
+ user_connect_callback_ = NULL;
+ c->Run(rv > OK ? OK : rv);
+}
+
+void SSLClientSocketOpenSSL::OnHandshakeIOComplete(int result) {
+ int rv = DoHandshakeLoop(result);
+ if (rv != ERR_IO_PENDING) {
+ DoConnectCallback(rv);
+ }
+}
+
+void SSLClientSocketOpenSSL::OnSendComplete(int result) {
+ if (next_handshake_state_ != STATE_NONE) {
+ // In handshake phase.
+ OnHandshakeIOComplete(result);
+ return;
+ }
+
+ // OnSendComplete may need to call DoPayloadRead while the renegotiation
+ // handshake is in progress.
+ int rv_read = ERR_IO_PENDING;
+ int rv_write = ERR_IO_PENDING;
+ bool network_moved;
+ do {
+ if (user_read_buf_)
+ rv_read = DoPayloadRead();
+ if (user_write_buf_)
+ rv_write = DoPayloadWrite();
+ network_moved = DoTransportIO();
+ } while (rv_read == ERR_IO_PENDING &&
+ rv_write == ERR_IO_PENDING &&
+ network_moved);
+
+ if (user_read_buf_ && rv_read != ERR_IO_PENDING)
+ DoReadCallback(rv_read);
+ if (user_write_buf_ && rv_write != ERR_IO_PENDING)
+ DoWriteCallback(rv_write);
+}
+
+void SSLClientSocketOpenSSL::OnRecvComplete(int result) {
+ if (next_handshake_state_ != STATE_NONE) {
+ // In handshake phase.
+ OnHandshakeIOComplete(result);
+ return;
+ }
+
+ // Network layer received some data, check if client requested to read
+ // decrypted data.
+ if (!user_read_buf_) {
+ //android_printLog(ANDROID_LOG_ERROR, "https", "recv with no user_read_buf_");
+ return;
+ }
+
+ int rv = DoReadLoop(result);
+ if (rv != ERR_IO_PENDING)
+ DoReadCallback(rv);
+}
+
+bool SSLClientSocketOpenSSL::IsConnected() const {
+ bool ret = completed_handshake_ && transport_->socket()->IsConnected();
+ return ret;
+}
+
+bool SSLClientSocketOpenSSL::IsConnectedAndIdle() const {
+ bool ret = completed_handshake_ && transport_->socket()->IsConnectedAndIdle();
+ return ret;
+}
+
+int SSLClientSocketOpenSSL::GetPeerAddress(AddressList* addressList) const {
+ return transport_->socket()->GetPeerAddress(addressList);
+}
+
+const BoundNetLog& SSLClientSocketOpenSSL::NetLog() const {
+ return net_log_;
+}
+
+// Socket methods
+
+int SSLClientSocketOpenSSL::Read(IOBuffer* buf, int buf_len, CompletionCallback* callback) {
+ user_read_buf_ = buf;
+ user_read_buf_len_ = buf_len;
+
+ int rv = DoReadLoop(OK);
+
+ if (rv == ERR_IO_PENDING)
+ user_read_callback_ = callback;
+ else {
+ user_read_buf_ = NULL;
+ user_read_buf_len_ = 0;
+ }
+
+ return rv;
+}
+
+int SSLClientSocketOpenSSL::DoReadLoop(int result) {
+ if (result < 0)
+ return result;
+
+ bool network_moved;
+ int rv;
+ do {
+ rv = DoPayloadRead();
+ network_moved = DoTransportIO();
+ } while (rv == ERR_IO_PENDING && network_moved);
+
+ return rv;
+}
+
+int SSLClientSocketOpenSSL::Write(IOBuffer* buf, int buf_len, CompletionCallback* callback) {
+ user_write_buf_ = buf;
+ user_write_buf_len_ = buf_len;
+
+ int rv = DoWriteLoop(OK);
+
+ if (rv == ERR_IO_PENDING)
+ user_write_callback_ = callback;
+ else {
+ user_write_buf_ = NULL;
+ user_write_buf_len_ = 0;
+ }
+
+ return rv;
+}
+
+int SSLClientSocketOpenSSL::DoWriteLoop(int result) {
+ if (result < 0)
+ return result;
+
+ bool network_moved;
+ int rv;
+ do {
+ rv = DoPayloadWrite();
+ network_moved = DoTransportIO();
+ } while (rv == ERR_IO_PENDING && network_moved);
+
+ return rv;
+}
+
+bool SSLClientSocketOpenSSL::SetReceiveBufferSize(int32 size) {
+ return true;
+}
+
+bool SSLClientSocketOpenSSL::SetSendBufferSize(int32 size) {
+ return true;
+}
+
+
+int SSLClientSocketOpenSSL::DoPayloadRead() {
+ int rv = SSL_read(ssl, user_read_buf_->data(), user_read_buf_len_);
+ if (client_auth_cert_needed_) {
+ // We don't need to invalidate the non-client-authenticated SSL session
+ // because the server will renegotiate anyway.
+ return ERR_SSL_CLIENT_AUTH_CERT_NEEDED;
+ }
+
+ if (rv >= 0) {
+ return rv;
+ }
+
+ int err = SSL_get_error(ssl, rv);
+ if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) {
+ // This will trigger another read/write after DoTransportIO
+ return ERR_IO_PENDING;
+ }
+
+ return rv; // return err instead?
+}
+
+int SSLClientSocketOpenSSL::DoPayloadWrite() {
+ int rv = SSL_write(ssl, user_write_buf_->data(), user_write_buf_len_);
+
+ if (rv >= 0) {
+ return rv;
+ }
+
+ int err = SSL_get_error(ssl, rv);
+ if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) {
+ // This will trigger another read/write after DoTransportIO
+ return ERR_IO_PENDING;
+ }
+
+ return rv; // return err instead ?
+}
+
+} // namespace net
diff --git a/net/socket/ssl_client_socket_openssl.h b/net/socket/ssl_client_socket_openssl.h
new file mode 100644
index 0000000..3fc1ac3
--- /dev/null
+++ b/net/socket/ssl_client_socket_openssl.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#ifndef NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_
+#define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_
+
+#include "base/scoped_ptr.h"
+#include "net/base/io_buffer.h"
+#include "net/base/ssl_config_service.h"
+#include "net/socket/ssl_client_socket.h"
+#include "net/socket/client_socket_handle.h"
+
+#include "openssl/ssl.h"
+
+namespace net {
+
+class SSLCertRequestInfo;
+class SSLConfig;
+class SSLInfo;
+
+// An SSL client socket implemented with OpenSSL.
+class SSLClientSocketOpenSSL : public SSLClientSocket {
+ public:
+ // Takes ownership of the transport_socket, which may already be connected.
+ // The given hostname will be compared with the name(s) in the server's
+ // certificate during the SSL handshake. ssl_config specifies the SSL
+ // settings.
+ SSLClientSocketOpenSSL(ClientSocketHandle* transport_socket,
+ const std::string& hostname,
+ const SSLConfig& ssl_config);
+ ~SSLClientSocketOpenSSL();
+
+ // SSLClientSocket methods:
+ virtual void GetSSLInfo(SSLInfo* ssl_info);
+ virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info);
+ virtual NextProtoStatus GetNextProto(std::string* proto);
+
+ // ClientSocket methods:
+ virtual int Connect(CompletionCallback* callback);
+ virtual void Disconnect();
+ virtual bool IsConnected() const;
+ virtual bool IsConnectedAndIdle() const;
+ virtual int GetPeerAddress(AddressList*) const;
+ virtual const BoundNetLog& NetLog() const;
+
+ // Socket methods:
+ virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback);
+ virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback);
+ virtual bool SetReceiveBufferSize(int32 size);
+ virtual bool SetSendBufferSize(int32 size);
+
+ private:
+ // Initializes OpenSSL SSL options. Returns a net error code.
+ bool InitializeSSLOptions();
+ bool InitOpenSSL();
+ bool Init();
+ void DoReadCallback(int result);
+ void DoWriteCallback(int result);
+
+ bool DoTransportIO();
+ int DoHandshake();
+ void DoConnectCallback(int result);
+
+ void OnHandshakeIOComplete(int result);
+ void OnSendComplete(int result);
+ void OnRecvComplete(int result);
+
+ int DoHandshakeLoop(int last_io_result);
+ int DoReadLoop(int result);
+ int DoWriteLoop(int result);
+ int DoPayloadRead();
+ int DoPayloadWrite();
+
+ int BufferSend(void);
+ int BufferRecv(void);
+ void BufferSendComplete(int result);
+ void BufferRecvComplete(int result);
+
+ CompletionCallbackImpl<SSLClientSocketOpenSSL> *buffer_send_callback_;
+ CompletionCallbackImpl<SSLClientSocketOpenSSL> *buffer_recv_callback_;
+ bool transport_send_busy_;
+ bool transport_recv_busy_;
+ scoped_refptr<IOBuffer> recv_buffer_;
+
+ CompletionCallback* user_connect_callback_;
+ CompletionCallback* user_read_callback_;
+ CompletionCallback* user_write_callback_;
+
+ // Used by Read function.
+ scoped_refptr<IOBuffer> user_read_buf_;
+ int user_read_buf_len_;
+
+ // Used by Write function.
+ scoped_refptr<IOBuffer> user_write_buf_;
+ int user_write_buf_len_;
+
+ // Stores client authentication information between ClientAuthHandler and
+ // GetSSLCertRequestInfo calls.
+ std::vector<scoped_refptr<X509Certificate> > client_certs_;
+ bool client_auth_cert_needed_;
+
+ // OpenSSL stuff
+ static SSL_CTX* ctx;
+ SSL* ssl;
+ BIO* bio_read;
+ BIO* bio_write;
+ size_t write_buf_size;
+
+ scoped_ptr<ClientSocketHandle> transport_;
+ std::string hostname_;
+ SSLConfig ssl_config_;
+
+ bool completed_handshake_;
+
+ enum State {
+ STATE_NONE,
+ STATE_HANDSHAKE,
+ STATE_VERIFY_CERT,
+ STATE_VERIFY_CERT_COMPLETE,
+ };
+ State next_handshake_state_;
+ BoundNetLog net_log_;
+};
+
+} // namespace net
+
+#endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_
+
diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc
index 2caa3fb..730f40e 100644
--- a/net/socket/tcp_client_socket_pool.cc
+++ b/net/socket/tcp_client_socket_pool.cc
@@ -150,6 +150,7 @@ int TCPConnectJob::DoTCPConnect() {
int TCPConnectJob::DoTCPConnectComplete(int result) {
if (result == OK) {
+#ifndef ANDROID
DCHECK(connect_start_time_ != base::TimeTicks());
DCHECK(start_time_ != base::TimeTicks());
base::TimeTicks now = base::TimeTicks::Now();
@@ -167,6 +168,7 @@ int TCPConnectJob::DoTCPConnectComplete(int result) {
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMinutes(10),
100);
+#endif
} else {
// Delete the socket on error.
set_socket(NULL);
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index 7256ec0..b238356 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -542,8 +542,8 @@ class URLRequest : public NonThreadSafe {
// Returns the priority level for this request.
net::RequestPriority priority() const { return priority_; }
void set_priority(net::RequestPriority priority) {
- DCHECK_GE(priority, net::HIGHEST);
- DCHECK_LE(priority, net::LOWEST);
+ //DCHECK_GE(priority, net::HIGHEST);
+ //DCHECK_LE(priority, net::LOWEST);
priority_ = priority;
}
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc
index 23a7d85..a31df82 100644
--- a/net/url_request/url_request_job.cc
+++ b/net/url_request/url_request_job.cc
@@ -737,6 +737,7 @@ void URLRequestJob::RecordPacketStats(StatisticSelector statistic) const {
base::TimeDelta duration = final_packet_time_ - request_time_snapshot_;
switch (statistic) {
+#ifndef ANDROID
case SDCH_DECODE: {
UMA_HISTOGRAM_CLIPPED_TIMES("Sdch3.Network_Decode_Latency_F_a", duration,
base::TimeDelta::FromMilliseconds(20),
@@ -853,6 +854,7 @@ void URLRequestJob::RecordPacketStats(StatisticSelector statistic) const {
base::TimeDelta::FromSeconds(10), 100);
return;
}
+#endif // ANDROID
default:
NOTREACHED();
return;
diff --git a/net/url_request/url_request_job_manager.cc b/net/url_request/url_request_job_manager.cc
index 0615280..5ea8563 100644
--- a/net/url_request/url_request_job_manager.cc
+++ b/net/url_request/url_request_job_manager.cc
@@ -31,9 +31,11 @@ static const SchemeToFactory kBuiltinFactories[] = {
{ "http", URLRequestHttpJob::Factory },
{ "https", URLRequestHttpJob::Factory },
{ "file", URLRequestFileJob::Factory },
+#ifndef ANDROID
{ "ftp", URLRequestFtpJob::Factory },
{ "about", URLRequestAboutJob::Factory },
{ "data", URLRequestDataJob::Factory },
+#endif
};
URLRequestJobManager::URLRequestJobManager() {
diff --git a/sdch/open-vcdiff/src/gflags/gflags.h b/sdch/open-vcdiff/src/gflags/gflags.h
index 5517ec4..ce4c1b8 100644
--- a/sdch/open-vcdiff/src/gflags/gflags.h
+++ b/sdch/open-vcdiff/src/gflags/gflags.h
@@ -105,7 +105,11 @@ typedef unsigned __int32 uint32;
typedef __int64 int64;
typedef unsigned __int64 uint64;
#else
-#error Do not know how to define a 32-bit integer quantity on your system
+typedef int32_t int32;
+typedef uint32_t uint32;
+typedef int64_t int64;
+typedef uint64_t uint64;
+//#error Do not know how to define a 32-bit integer quantity on your system
#endif
// --------------------------------------------------------------------
diff --git a/third_party/libevent/android/config.h b/third_party/libevent/android/config.h
new file mode 100644
index 0000000..787d8ad
--- /dev/null
+++ b/third_party/libevent/android/config.h
@@ -0,0 +1,268 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define if clock_gettime is available in libc */
+#define DNS_USE_CPU_CLOCK_FOR_ID 1
+
+/* Define is no secure id variant is available */
+/* #undef DNS_USE_GETTIMEOFDAY_FOR_ID */
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define HAVE_CLOCK_GETTIME 1
+
+/* Define if /dev/poll is available */
+/* #undef HAVE_DEVPOLL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define if your system supports the epoll system calls */
+#ifndef HAVE_EPOLL
+ #define HAVE_EPOLL 1
+#endif
+
+/* Define to 1 if you have the `epoll_ctl' function. */
+#define HAVE_EPOLL_CTL 1
+
+/* Define if your system supports event ports */
+/* #undef HAVE_EVENT_PORTS */
+
+/* Define to 1 if you have the `fcntl' function. */
+#define HAVE_FCNTL 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if the system has the type `fd_mask'. */
+//#define HAVE_FD_MASK 0
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getegid' function. */
+#define HAVE_GETEGID 1
+
+/* Define to 1 if you have the `geteuid' function. */
+#define HAVE_GETEUID 1
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#define HAVE_GETNAMEINFO 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the `inet_ntop' function. */
+#define HAVE_INET_NTOP 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `issetugid' function. */
+/* #undef HAVE_ISSETUGID */
+
+/* Define to 1 if you have the `kqueue' function. */
+/* #undef HAVE_KQUEUE */
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+#define HAVE_LIBNSL 1
+
+/* Define to 1 if you have the `resolv' library (-lresolv). */
+#define HAVE_LIBRESOLV 1
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+#define HAVE_LIBRT 1
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <netinet/in6.h> header file. */
+/* #undef HAVE_NETINET_IN6_H */
+
+/* Define to 1 if you have the `poll' function. */
+#define HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `port_create' function. */
+/* #undef HAVE_PORT_CREATE */
+
+/* Define to 1 if you have the <port.h> header file. */
+/* #undef HAVE_PORT_H */
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define if F_SETFD is defined in <fcntl.h> */
+#define HAVE_SETFD 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `signal' function. */
+#define HAVE_SIGNAL 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+/* #undef HAVE_STRLCPY */
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strtok_r' function. */
+#define HAVE_STRTOK_R 1
+
+/* Define to 1 if you have the `strtoll' function. */
+#define HAVE_STRTOLL 1
+
+/* Define to 1 if the system has the type `struct in6_addr'. */
+#define HAVE_STRUCT_IN6_ADDR 1
+
+/* Define to 1 if you have the <sys/devpoll.h> header file. */
+/* #undef HAVE_SYS_DEVPOLL_H */
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+#define HAVE_SYS_EPOLL_H 1
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+/* #undef HAVE_SYS_EVENT_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#define HAVE_SYS_QUEUE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
+#define HAVE_TAILQFOREACH 1
+
+/* Define if timeradd is defined in <sys/time.h> */
+#define HAVE_TIMERADD 1
+
+/* Define if timerclear is defined in <sys/time.h> */
+#define HAVE_TIMERCLEAR 1
+
+/* Define if timercmp is defined in <sys/time.h> */
+#define HAVE_TIMERCMP 1
+
+/* Define if timerisset is defined in <sys/time.h> */
+#define HAVE_TIMERISSET 1
+
+/* Define to 1 if the system has the type `uint16_t'. */
+#define HAVE_UINT16_T 1
+
+/* Define to 1 if the system has the type `uint32_t'. */
+#define HAVE_UINT32_T 1
+
+/* Define to 1 if the system has the type `uint64_t'. */
+#define HAVE_UINT64_T 1
+
+/* Define to 1 if the system has the type `uint8_t'. */
+#define HAVE_UINT8_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vasprintf' function. */
+#define HAVE_VASPRINTF 1
+
+/* Define if kqueue works correctly with pipes */
+/* #undef HAVE_WORKING_KQUEUE */
+
+/* Name of package */
+#define PACKAGE "libevent"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* The size of `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of `long', as computed by sizeof. */
+#define SIZEOF_LONG 8
+
+/* The size of `long long', as computed by sizeof. */
+#define SIZEOF_LONG_LONG 8
+
+/* The size of `short', as computed by sizeof. */
+#define SIZEOF_SHORT 2
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "1.4.13-stable"
+
+/* Define to appropriate substitue if compiler doesnt have __func__ */
+/* #undef __func__ */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to unsigned int if you dont have it */
+/* #undef socklen_t */
diff --git a/third_party/libevent/android/event-config.h b/third_party/libevent/android/event-config.h
new file mode 100644
index 0000000..226605e
--- /dev/null
+++ b/third_party/libevent/android/event-config.h
@@ -0,0 +1,274 @@
+/* event-config.h
+ * Generated by autoconf; post-processed by libevent.
+ * Do not edit this file.
+ * Do not rely on macros in this file existing in later versions.
+ */
+#ifndef _EVENT_CONFIG_H_
+#define _EVENT_CONFIG_H_
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define if clock_gettime is available in libc */
+#define _EVENT_DNS_USE_CPU_CLOCK_FOR_ID 1
+
+/* Define is no secure id variant is available */
+/* #undef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID */
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define _EVENT_HAVE_CLOCK_GETTIME 1
+
+/* Define if /dev/poll is available */
+/* #undef _EVENT_HAVE_DEVPOLL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define _EVENT_HAVE_DLFCN_H 1
+
+/* Define if your system supports the epoll system calls */
+#define _EVENT_HAVE_EPOLL 1
+
+/* Define to 1 if you have the `epoll_ctl' function. */
+#define _EVENT_HAVE_EPOLL_CTL 1
+
+/* Define if your system supports event ports */
+/* #undef _EVENT_HAVE_EVENT_PORTS */
+
+/* Define to 1 if you have the `fcntl' function. */
+#define _EVENT_HAVE_FCNTL 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define _EVENT_HAVE_FCNTL_H 1
+
+/* Define to 1 if the system has the type `fd_mask'. */
+//#define _EVENT_HAVE_FD_MASK 0
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define _EVENT_HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getegid' function. */
+#define _EVENT_HAVE_GETEGID 1
+
+/* Define to 1 if you have the `geteuid' function. */
+#define _EVENT_HAVE_GETEUID 1
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#define _EVENT_HAVE_GETNAMEINFO 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define _EVENT_HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the `inet_ntop' function. */
+#define _EVENT_HAVE_INET_NTOP 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define _EVENT_HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `issetugid' function. */
+/* #undef _EVENT_HAVE_ISSETUGID */
+
+/* Define to 1 if you have the `kqueue' function. */
+/* #undef _EVENT_HAVE_KQUEUE */
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+#define _EVENT_HAVE_LIBNSL 1
+
+/* Define to 1 if you have the `resolv' library (-lresolv). */
+#define _EVENT_HAVE_LIBRESOLV 1
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+#define _EVENT_HAVE_LIBRT 1
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+/* #undef _EVENT_HAVE_LIBSOCKET */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define _EVENT_HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <netinet/in6.h> header file. */
+/* #undef _EVENT_HAVE_NETINET_IN6_H */
+
+/* Define to 1 if you have the `poll' function. */
+#define _EVENT_HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define _EVENT_HAVE_POLL_H 1
+
+/* Define to 1 if you have the `port_create' function. */
+/* #undef _EVENT_HAVE_PORT_CREATE */
+
+/* Define to 1 if you have the <port.h> header file. */
+/* #undef _EVENT_HAVE_PORT_H */
+
+/* Define to 1 if you have the `select' function. */
+#define _EVENT_HAVE_SELECT 1
+
+/* Define if F_SETFD is defined in <fcntl.h> */
+#define _EVENT_HAVE_SETFD 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define _EVENT_HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `signal' function. */
+#define _EVENT_HAVE_SIGNAL 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define _EVENT_HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define _EVENT_HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define _EVENT_HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define _EVENT_HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define _EVENT_HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define _EVENT_HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+/* #undef _EVENT_HAVE_STRLCPY */
+
+/* Define to 1 if you have the `strsep' function. */
+#define _EVENT_HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strtok_r' function. */
+#define _EVENT_HAVE_STRTOK_R 1
+
+/* Define to 1 if you have the `strtoll' function. */
+#define _EVENT_HAVE_STRTOLL 1
+
+/* Define to 1 if the system has the type `struct in6_addr'. */
+#define _EVENT_HAVE_STRUCT_IN6_ADDR 1
+
+/* Define to 1 if you have the <sys/devpoll.h> header file. */
+/* #undef _EVENT_HAVE_SYS_DEVPOLL_H */
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+#define _EVENT_HAVE_SYS_EPOLL_H 1
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+/* #undef _EVENT_HAVE_SYS_EVENT_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define _EVENT_HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define _EVENT_HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#define _EVENT_HAVE_SYS_QUEUE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define _EVENT_HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define _EVENT_HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define _EVENT_HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define _EVENT_HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define _EVENT_HAVE_SYS_TYPES_H 1
+
+/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
+#define _EVENT_HAVE_TAILQFOREACH 1
+
+/* Define if timeradd is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERADD 1
+
+/* Define if timerclear is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERCLEAR 1
+
+/* Define if timercmp is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERCMP 1
+
+/* Define if timerisset is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERISSET 1
+
+/* Define to 1 if the system has the type `uint16_t'. */
+#define _EVENT_HAVE_UINT16_T 1
+
+/* Define to 1 if the system has the type `uint32_t'. */
+#define _EVENT_HAVE_UINT32_T 1
+
+/* Define to 1 if the system has the type `uint64_t'. */
+#define _EVENT_HAVE_UINT64_T 1
+
+/* Define to 1 if the system has the type `uint8_t'. */
+#define _EVENT_HAVE_UINT8_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define _EVENT_HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vasprintf' function. */
+#define _EVENT_HAVE_VASPRINTF 1
+
+/* Define if kqueue works correctly with pipes */
+/* #undef _EVENT_HAVE_WORKING_KQUEUE */
+
+/* Name of package */
+#define _EVENT_PACKAGE "libevent"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define _EVENT_PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define _EVENT_PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define _EVENT_PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define _EVENT_PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define _EVENT_PACKAGE_VERSION ""
+
+/* The size of `int', as computed by sizeof. */
+#define _EVENT_SIZEOF_INT 4
+
+/* The size of `long', as computed by sizeof. */
+#define _EVENT_SIZEOF_LONG 8
+
+/* The size of `long long', as computed by sizeof. */
+#define _EVENT_SIZEOF_LONG_LONG 8
+
+/* The size of `short', as computed by sizeof. */
+#define _EVENT_SIZEOF_SHORT 2
+
+/* Define to 1 if you have the ANSI C header files. */
+#define _EVENT_STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define _EVENT_TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define _EVENT_VERSION "1.4.13-stable"
+
+/* Define to appropriate substitue if compiler doesnt have __func__ */
+/* #undef _EVENT___func__ */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef _EVENT_const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef _EVENT___cplusplus
+/* #undef _EVENT_inline */
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef _EVENT_pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef _EVENT_size_t */
+
+/* Define to unsigned int if you dont have it */
+/* #undef _EVENT_socklen_t */
+#endif
diff --git a/third_party/libevent/event.c b/third_party/libevent/event.c
index d7ccd3f..0bdcd78 100644
--- a/third_party/libevent/event.c
+++ b/third_party/libevent/event.c
@@ -25,7 +25,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
+#ifdef ANDROID // maybe libevent should be in a seperate lib ...
+#include "android/config.h"
+#else
#include "config.h"
+#endif //Android
#endif
#ifdef WIN32
diff --git a/third_party/libevent/evutil.c b/third_party/libevent/evutil.c
index 564377d..f281fc7 100644
--- a/third_party/libevent/evutil.c
+++ b/third_party/libevent/evutil.c
@@ -25,7 +25,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
+#ifdef ANDROID // maybe libevent should be in a seperate lib ...
+#include "android/config.h"
+#else
#include "config.h"
+#endif //Android
#endif
#ifdef WIN32
diff --git a/third_party/libevent/select.c b/third_party/libevent/select.c
index 3f73331..778cfd7 100644
--- a/third_party/libevent/select.c
+++ b/third_party/libevent/select.c
@@ -60,12 +60,13 @@
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
-#ifndef _EVENT_HAVE_FD_MASK
+//#ifndef _EVENT_HAVE_FD_MASK
+#ifdef ANDROID
/* This type is mandatory, but Android doesn't define it. */
#undef NFDBITS
#define NFDBITS (sizeof(long)*8)
typedef unsigned long fd_mask;
-#endif
+#endif // ANDROID
struct selectop {
int event_fds; /* Highest fd in fd set */