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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 getter.get(), &CookieGetter::Get, url)); | 878 getter.get(), &CookieGetter::Get, url)); |
879 | 879 |
880 return getter->GetResult(); | 880 return getter->GetResult(); |
881 } | 881 } |
882 | 882 |
883 // static | 883 // static |
884 bool SimpleResourceLoaderBridge::EnsureIOThread() { | 884 bool SimpleResourceLoaderBridge::EnsureIOThread() { |
885 if (g_io_thread) | 885 if (g_io_thread) |
886 return true; | 886 return true; |
887 | 887 |
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) | 888 #if defined(OS_MACOSX) || defined(OS_WIN) |
895 // We want to be sure to init NSPR on the main thread. | 889 // We want to be sure to init NSPR on the main thread. |
896 base::EnsureNSPRInit(); | 890 base::EnsureNSPRInit(); |
897 #endif | 891 #endif |
898 | 892 |
899 // Create the cache thread. We want the cache thread to outlive the IO thread, | 893 // 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. | 894 // so its lifetime is bonded to the IO thread lifetime. |
901 DCHECK(!g_cache_thread); | 895 DCHECK(!g_cache_thread); |
902 g_cache_thread = new base::Thread("cache"); | 896 g_cache_thread = new base::Thread("cache"); |
903 CHECK(g_cache_thread->StartWithOptions( | 897 CHECK(g_cache_thread->StartWithOptions( |
(...skipping 24 matching lines...) Expand all Loading... |
928 | 922 |
929 // static | 923 // static |
930 scoped_refptr<base::MessageLoopProxy> | 924 scoped_refptr<base::MessageLoopProxy> |
931 SimpleResourceLoaderBridge::GetIoThread() { | 925 SimpleResourceLoaderBridge::GetIoThread() { |
932 if (!EnsureIOThread()) { | 926 if (!EnsureIOThread()) { |
933 LOG(DFATAL) << "Failed to create IO thread."; | 927 LOG(DFATAL) << "Failed to create IO thread."; |
934 return NULL; | 928 return NULL; |
935 } | 929 } |
936 return g_io_thread->message_loop_proxy(); | 930 return g_io_thread->message_loop_proxy(); |
937 } | 931 } |
OLD | NEW |