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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 g_request_context = new TestShellRequestContext( | 206 g_request_context = new TestShellRequestContext( |
207 g_request_context_params->cache_path, | 207 g_request_context_params->cache_path, |
208 g_request_context_params->cache_mode, | 208 g_request_context_params->cache_mode, |
209 g_request_context_params->no_proxy); | 209 g_request_context_params->no_proxy); |
210 delete g_request_context_params; | 210 delete g_request_context_params; |
211 g_request_context_params = NULL; | 211 g_request_context_params = NULL; |
212 } else { | 212 } else { |
213 g_request_context = new TestShellRequestContext(); | 213 g_request_context = new TestShellRequestContext(); |
214 } | 214 } |
215 | 215 |
216 g_request_context->AddRef(); | |
217 | |
218 g_network_delegate = new TestShellNetworkDelegate(); | 216 g_network_delegate = new TestShellNetworkDelegate(); |
219 g_request_context->set_network_delegate(g_network_delegate); | 217 g_request_context->set_network_delegate(g_network_delegate); |
220 | 218 |
221 SimpleAppCacheSystem::InitializeOnIOThread(g_request_context); | 219 SimpleAppCacheSystem::InitializeOnIOThread(g_request_context); |
222 SimpleSocketStreamBridge::InitializeOnIOThread(g_request_context); | 220 SimpleSocketStreamBridge::InitializeOnIOThread(g_request_context); |
223 SimpleFileWriter::InitializeOnIOThread(g_request_context); | 221 SimpleFileWriter::InitializeOnIOThread(g_request_context); |
224 SimpleFileSystem::InitializeOnIOThread( | 222 SimpleFileSystem::InitializeOnIOThread( |
225 g_request_context->blob_storage_controller()); | 223 g_request_context->blob_storage_controller()); |
226 TestShellWebBlobRegistryImpl::InitializeOnIOThread( | 224 TestShellWebBlobRegistryImpl::InitializeOnIOThread( |
227 g_request_context->blob_storage_controller()); | 225 g_request_context->blob_storage_controller()); |
228 } | 226 } |
229 | 227 |
230 virtual void CleanUp() OVERRIDE { | 228 virtual void CleanUp() OVERRIDE { |
231 // In reverse order of initialization. | 229 // In reverse order of initialization. |
232 TestShellWebBlobRegistryImpl::Cleanup(); | 230 TestShellWebBlobRegistryImpl::Cleanup(); |
233 SimpleFileSystem::CleanupOnIOThread(); | 231 SimpleFileSystem::CleanupOnIOThread(); |
234 SimpleFileWriter::CleanupOnIOThread(); | 232 SimpleFileWriter::CleanupOnIOThread(); |
235 SimpleSocketStreamBridge::Cleanup(); | 233 SimpleSocketStreamBridge::Cleanup(); |
236 SimpleAppCacheSystem::CleanupOnIOThread(); | 234 SimpleAppCacheSystem::CleanupOnIOThread(); |
237 | 235 |
238 if (g_request_context) { | 236 if (g_request_context) { |
239 g_request_context->set_network_delegate(NULL); | 237 g_request_context->set_network_delegate(NULL); |
240 g_request_context->Release(); | 238 delete g_request_context; |
241 g_request_context = NULL; | 239 g_request_context = NULL; |
242 } | 240 } |
243 | 241 |
244 if (g_network_delegate) { | 242 if (g_network_delegate) { |
245 delete g_network_delegate; | 243 delete g_network_delegate; |
246 g_network_delegate = NULL; | 244 g_network_delegate = NULL; |
247 } | 245 } |
248 } | 246 } |
249 }; | 247 }; |
250 | 248 |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); | 1115 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); |
1118 g_file_over_http_params = new FileOverHTTPParams(file_path_template, | 1116 g_file_over_http_params = new FileOverHTTPParams(file_path_template, |
1119 http_prefix); | 1117 http_prefix); |
1120 } | 1118 } |
1121 | 1119 |
1122 // static | 1120 // static |
1123 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( | 1121 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( |
1124 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 1122 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
1125 return new ResourceLoaderBridgeImpl(request_info); | 1123 return new ResourceLoaderBridgeImpl(request_info); |
1126 } | 1124 } |
OLD | NEW |