Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: webkit/tools/test_shell/simple_resource_loader_bridge.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_operation_write_unittest.cc ('k') | webkit/tools/test_shell/simple_socket_stream_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698