OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file contains an implementation of the ResourceLoaderBridge class. | 5 // This file contains an implementation of the ResourceLoaderBridge class. |
6 // The class is implemented using net::URLRequest, meaning it is a "simple" | 6 // The class is implemented using net::URLRequest, meaning it is a "simple" |
7 // version that directly issues requests. The more complicated one used in the | 7 // version that directly issues requests. The more complicated one used in the |
8 // browser uses IPC. | 8 // browser uses IPC. |
9 // | 9 // |
10 // Because net::URLRequest only provides an asynchronous resource loading API, | 10 // Because net::URLRequest only provides an asynchronous resource loading API, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "net/base/io_buffer.h" | 50 #include "net/base/io_buffer.h" |
51 #include "net/base/load_flags.h" | 51 #include "net/base/load_flags.h" |
52 #include "net/base/net_errors.h" | 52 #include "net/base/net_errors.h" |
53 #include "net/base/net_util.h" | 53 #include "net/base/net_util.h" |
54 #include "net/base/static_cookie_policy.h" | 54 #include "net/base/static_cookie_policy.h" |
55 #include "net/base/upload_data.h" | 55 #include "net/base/upload_data.h" |
56 #include "net/http/http_cache.h" | 56 #include "net/http/http_cache.h" |
57 #include "net/http/http_request_headers.h" | 57 #include "net/http/http_request_headers.h" |
58 #include "net/http/http_response_headers.h" | 58 #include "net/http/http_response_headers.h" |
59 #include "net/proxy/proxy_service.h" | 59 #include "net/proxy/proxy_service.h" |
60 #if defined(OS_WIN) | |
61 #include "net/socket/ssl_client_socket_nss_factory.h" | |
62 #endif | |
63 #include "net/url_request/url_request.h" | 60 #include "net/url_request/url_request.h" |
64 #include "net/url_request/url_request_job.h" | 61 #include "net/url_request/url_request_job.h" |
65 #include "webkit/appcache/appcache_interfaces.h" | 62 #include "webkit/appcache/appcache_interfaces.h" |
66 #include "webkit/blob/blob_storage_controller.h" | 63 #include "webkit/blob/blob_storage_controller.h" |
67 #include "webkit/blob/blob_url_request_job.h" | 64 #include "webkit/blob/blob_url_request_job.h" |
68 #include "webkit/blob/deletable_file_reference.h" | 65 #include "webkit/blob/deletable_file_reference.h" |
69 #include "webkit/glue/resource_loader_bridge.h" | 66 #include "webkit/glue/resource_loader_bridge.h" |
70 #include "webkit/tools/test_shell/simple_appcache_system.h" | 67 #include "webkit/tools/test_shell/simple_appcache_system.h" |
71 #include "webkit/tools/test_shell/simple_file_writer.h" | 68 #include "webkit/tools/test_shell/simple_file_writer.h" |
72 #include "webkit/tools/test_shell/simple_socket_stream_bridge.h" | 69 #include "webkit/tools/test_shell/simple_socket_stream_bridge.h" |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 getter.get(), &CookieGetter::Get, url)); | 875 getter.get(), &CookieGetter::Get, url)); |
879 | 876 |
880 return getter->GetResult(); | 877 return getter->GetResult(); |
881 } | 878 } |
882 | 879 |
883 // static | 880 // static |
884 bool SimpleResourceLoaderBridge::EnsureIOThread() { | 881 bool SimpleResourceLoaderBridge::EnsureIOThread() { |
885 if (g_io_thread) | 882 if (g_io_thread) |
886 return true; | 883 return true; |
887 | 884 |
888 #if defined(OS_WIN) | |
889 // Use NSS for SSL on Windows. TODO(wtc): this should eventually be hidden | |
890 // inside DefaultClientSocketFactory::CreateSSLClientSocket. | |
891 net::ClientSocketFactory::SetSSLClientSocketFactory( | |
892 net::SSLClientSocketNSSFactory); | |
893 #endif | |
894 #if defined(OS_MACOSX) || defined(OS_WIN) | 885 #if defined(OS_MACOSX) || defined(OS_WIN) |
895 // We want to be sure to init NSPR on the main thread. | 886 // We want to be sure to init NSPR on the main thread. |
896 base::EnsureNSPRInit(); | 887 base::EnsureNSPRInit(); |
897 #endif | 888 #endif |
898 | 889 |
899 // Create the cache thread. We want the cache thread to outlive the IO thread, | 890 // Create the cache thread. We want the cache thread to outlive the IO thread, |
900 // so its lifetime is bonded to the IO thread lifetime. | 891 // so its lifetime is bonded to the IO thread lifetime. |
901 DCHECK(!g_cache_thread); | 892 DCHECK(!g_cache_thread); |
902 g_cache_thread = new base::Thread("cache"); | 893 g_cache_thread = new base::Thread("cache"); |
903 CHECK(g_cache_thread->StartWithOptions( | 894 CHECK(g_cache_thread->StartWithOptions( |
(...skipping 24 matching lines...) Expand all Loading... |
928 | 919 |
929 // static | 920 // static |
930 scoped_refptr<base::MessageLoopProxy> | 921 scoped_refptr<base::MessageLoopProxy> |
931 SimpleResourceLoaderBridge::GetIoThread() { | 922 SimpleResourceLoaderBridge::GetIoThread() { |
932 if (!EnsureIOThread()) { | 923 if (!EnsureIOThread()) { |
933 LOG(DFATAL) << "Failed to create IO thread."; | 924 LOG(DFATAL) << "Failed to create IO thread."; |
934 return NULL; | 925 return NULL; |
935 } | 926 } |
936 return g_io_thread->message_loop_proxy(); | 927 return g_io_thread->message_loop_proxy(); |
937 } | 928 } |
OLD | NEW |