OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/net/chrome_url_request_context.h" | 5 #include "chrome/browser/net/chrome_url_request_context.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 scoped_ptr<net::ProxyConfig> proxy_config(CreateProxyConfig(command_line)); | 88 scoped_ptr<net::ProxyConfig> proxy_config(CreateProxyConfig(command_line)); |
89 | 89 |
90 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver); | 90 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver); |
91 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) { | 91 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) { |
92 // See the note about V8 multithreading in net/proxy/proxy_resolver_v8.h | 92 // See the note about V8 multithreading in net/proxy/proxy_resolver_v8.h |
93 // to understand why we have this limitation. | 93 // to understand why we have this limitation. |
94 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode."; | 94 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode."; |
95 use_v8 = false; // Fallback to non-v8 implementation. | 95 use_v8 = false; // Fallback to non-v8 implementation. |
96 } | 96 } |
97 | 97 |
98 return use_v8 ? | 98 return net::ProxyService::Create( |
99 net::ProxyService::CreateUsingV8Resolver(proxy_config.get(), context) : | 99 proxy_config.get(), |
100 net::ProxyService::Create(proxy_config.get()); | 100 use_v8, |
| 101 context, |
| 102 g_browser_process->io_thread()->message_loop()); |
101 } | 103 } |
102 | 104 |
103 // static | 105 // static |
104 ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginal( | 106 ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginal( |
105 Profile* profile, const FilePath& cookie_store_path, | 107 Profile* profile, const FilePath& cookie_store_path, |
106 const FilePath& disk_cache_path) { | 108 const FilePath& disk_cache_path) { |
107 DCHECK(!profile->IsOffTheRecord()); | 109 DCHECK(!profile->IsOffTheRecord()); |
108 ChromeURLRequestContext* context = new ChromeURLRequestContext(profile); | 110 ChromeURLRequestContext* context = new ChromeURLRequestContext(profile); |
109 | 111 |
110 context->proxy_service_ = CreateProxyService( | 112 context->proxy_service_ = CreateProxyService( |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // Do not delete the cookie store in the case of the media context, as it is | 415 // Do not delete the cookie store in the case of the media context, as it is |
414 // owned by the original context. | 416 // owned by the original context. |
415 if (!is_media_) | 417 if (!is_media_) |
416 delete cookie_store_; | 418 delete cookie_store_; |
417 | 419 |
418 // Do not delete the proxy service in the case of OTR or media contexts, as | 420 // Do not delete the proxy service in the case of OTR or media contexts, as |
419 // it is owned by the original URLRequestContext. | 421 // it is owned by the original URLRequestContext. |
420 if (!is_off_the_record_ && !is_media_) | 422 if (!is_off_the_record_ && !is_media_) |
421 delete proxy_service_; | 423 delete proxy_service_; |
422 } | 424 } |
OLD | NEW |