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

Side by Side Diff: net/url_request/url_request_job_manager.cc

Issue 5634005: Add a new GetInstance() method for singleton classes under chrome/service and /net. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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) 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 "net/url_request/url_request_job_manager.h" 5 #include "net/url_request/url_request_job_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 27 matching lines...) Expand all
38 38
39 URLRequestJobManager::URLRequestJobManager() : enable_file_access_(false) { 39 URLRequestJobManager::URLRequestJobManager() : enable_file_access_(false) {
40 #ifndef NDEBUG 40 #ifndef NDEBUG
41 allowed_thread_ = 0; 41 allowed_thread_ = 0;
42 allowed_thread_initialized_ = false; 42 allowed_thread_initialized_ = false;
43 #endif 43 #endif
44 } 44 }
45 45
46 URLRequestJobManager::~URLRequestJobManager() {} 46 URLRequestJobManager::~URLRequestJobManager() {}
47 47
48 // static
49 URLRequestJobManager* URLRequestJobManager::GetInstance() {
50 return Singleton<URLRequestJobManager>::get();
51 }
52
48 URLRequestJob* URLRequestJobManager::CreateJob(net::URLRequest* request) const { 53 URLRequestJob* URLRequestJobManager::CreateJob(net::URLRequest* request) const {
49 #ifndef NDEBUG 54 #ifndef NDEBUG
50 DCHECK(IsAllowedThread()); 55 DCHECK(IsAllowedThread());
51 #endif 56 #endif
52 57
53 // If we are given an invalid URL, then don't even try to inspect the scheme. 58 // If we are given an invalid URL, then don't even try to inspect the scheme.
54 if (!request->url().is_valid()) 59 if (!request->url().is_valid())
55 return new URLRequestErrorJob(request, net::ERR_INVALID_URL); 60 return new URLRequestErrorJob(request, net::ERR_INVALID_URL);
56 61
57 // We do this here to avoid asking interceptors about unsupported schemes. 62 // We do this here to avoid asking interceptors about unsupported schemes.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 DCHECK(IsAllowedThread()); 203 DCHECK(IsAllowedThread());
199 #endif 204 #endif
200 205
201 AutoLock locked(lock_); 206 AutoLock locked(lock_);
202 207
203 InterceptorList::iterator i = 208 InterceptorList::iterator i =
204 std::find(interceptors_.begin(), interceptors_.end(), interceptor); 209 std::find(interceptors_.begin(), interceptors_.end(), interceptor);
205 DCHECK(i != interceptors_.end()); 210 DCHECK(i != interceptors_.end());
206 interceptors_.erase(i); 211 interceptors_.erase(i);
207 } 212 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698