OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 g_request_context = new TestShellRequestContext( | 210 g_request_context = new TestShellRequestContext( |
211 g_request_context_params->cache_path, | 211 g_request_context_params->cache_path, |
212 g_request_context_params->cache_mode, | 212 g_request_context_params->cache_mode, |
213 g_request_context_params->no_proxy); | 213 g_request_context_params->no_proxy); |
214 delete g_request_context_params; | 214 delete g_request_context_params; |
215 g_request_context_params = NULL; | 215 g_request_context_params = NULL; |
216 } else { | 216 } else { |
217 g_request_context = new TestShellRequestContext(); | 217 g_request_context = new TestShellRequestContext(); |
218 } | 218 } |
219 | 219 |
220 g_request_context->AddRef(); | |
221 | |
222 g_network_delegate = new TestShellNetworkDelegate(); | 220 g_network_delegate = new TestShellNetworkDelegate(); |
223 g_request_context->set_network_delegate(g_network_delegate); | 221 g_request_context->set_network_delegate(g_network_delegate); |
224 | 222 |
225 SimpleAppCacheSystem::InitializeOnIOThread(g_request_context); | 223 SimpleAppCacheSystem::InitializeOnIOThread(g_request_context); |
226 SimpleSocketStreamBridge::InitializeOnIOThread(g_request_context); | 224 SimpleSocketStreamBridge::InitializeOnIOThread(g_request_context); |
227 SimpleFileWriter::InitializeOnIOThread(g_request_context); | 225 SimpleFileWriter::InitializeOnIOThread(g_request_context); |
228 SimpleFileSystem::InitializeOnIOThread( | 226 SimpleFileSystem::InitializeOnIOThread( |
229 g_request_context->blob_storage_controller()); | 227 g_request_context->blob_storage_controller()); |
230 TestShellWebBlobRegistryImpl::InitializeOnIOThread( | 228 TestShellWebBlobRegistryImpl::InitializeOnIOThread( |
231 g_request_context->blob_storage_controller()); | 229 g_request_context->blob_storage_controller()); |
232 } | 230 } |
233 | 231 |
234 virtual void CleanUp() OVERRIDE { | 232 virtual void CleanUp() OVERRIDE { |
235 // In reverse order of initialization. | 233 // In reverse order of initialization. |
236 TestShellWebBlobRegistryImpl::Cleanup(); | 234 TestShellWebBlobRegistryImpl::Cleanup(); |
237 SimpleFileSystem::CleanupOnIOThread(); | 235 SimpleFileSystem::CleanupOnIOThread(); |
238 SimpleFileWriter::CleanupOnIOThread(); | 236 SimpleFileWriter::CleanupOnIOThread(); |
239 SimpleSocketStreamBridge::Cleanup(); | 237 SimpleSocketStreamBridge::Cleanup(); |
240 SimpleAppCacheSystem::CleanupOnIOThread(); | 238 SimpleAppCacheSystem::CleanupOnIOThread(); |
241 | 239 |
242 if (g_request_context) { | 240 if (g_request_context) { |
243 g_request_context->set_network_delegate(NULL); | 241 g_request_context->set_network_delegate(NULL); |
244 g_request_context->Release(); | 242 delete g_request_context; |
245 g_request_context = NULL; | 243 g_request_context = NULL; |
246 } | 244 } |
247 | 245 |
248 if (g_network_delegate) { | 246 if (g_network_delegate) { |
249 delete g_network_delegate; | 247 delete g_network_delegate; |
250 g_network_delegate = NULL; | 248 g_network_delegate = NULL; |
251 } | 249 } |
252 } | 250 } |
253 }; | 251 }; |
254 | 252 |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); | 1123 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); |
1126 g_file_over_http_params = new FileOverHTTPParams(file_path_template, | 1124 g_file_over_http_params = new FileOverHTTPParams(file_path_template, |
1127 http_prefix); | 1125 http_prefix); |
1128 } | 1126 } |
1129 | 1127 |
1130 // static | 1128 // static |
1131 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( | 1129 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( |
1132 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 1130 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
1133 return new ResourceLoaderBridgeImpl(request_info); | 1131 return new ResourceLoaderBridgeImpl(request_info); |
1134 } | 1132 } |
OLD | NEW |