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

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

Issue 6142009: Upating the app, ceee, chrome, ipc, media, and net directories to use the correct lock.h file. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Unified patch updating all references to the new base/synchronization/lock.h Created 9 years, 11 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
« no previous file with comments | « net/url_request/url_request_job_manager.h ('k') | printing/backend/print_backend_cups.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/singleton.h" 10 #include "base/singleton.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 net::URLRequestJob* job = (*i)->MaybeInterceptResponse(request); 145 net::URLRequestJob* job = (*i)->MaybeInterceptResponse(request);
146 if (job) 146 if (job)
147 return job; 147 return job;
148 } 148 }
149 return NULL; 149 return NULL;
150 } 150 }
151 151
152 bool URLRequestJobManager::SupportsScheme(const std::string& scheme) const { 152 bool URLRequestJobManager::SupportsScheme(const std::string& scheme) const {
153 // The set of registered factories may change on another thread. 153 // The set of registered factories may change on another thread.
154 { 154 {
155 AutoLock locked(lock_); 155 base::AutoLock locked(lock_);
156 if (factories_.find(scheme) != factories_.end()) 156 if (factories_.find(scheme) != factories_.end())
157 return true; 157 return true;
158 } 158 }
159 159
160 for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) 160 for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i)
161 if (LowerCaseEqualsASCII(scheme, kBuiltinFactories[i].scheme)) 161 if (LowerCaseEqualsASCII(scheme, kBuiltinFactories[i].scheme))
162 return true; 162 return true;
163 163
164 return false; 164 return false;
165 } 165 }
166 166
167 net::URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory( 167 net::URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory(
168 const std::string& scheme, 168 const std::string& scheme,
169 net::URLRequest::ProtocolFactory* factory) { 169 net::URLRequest::ProtocolFactory* factory) {
170 #ifndef NDEBUG 170 #ifndef NDEBUG
171 DCHECK(IsAllowedThread()); 171 DCHECK(IsAllowedThread());
172 #endif 172 #endif
173 173
174 AutoLock locked(lock_); 174 base::AutoLock locked(lock_);
175 175
176 net::URLRequest::ProtocolFactory* old_factory; 176 net::URLRequest::ProtocolFactory* old_factory;
177 FactoryMap::iterator i = factories_.find(scheme); 177 FactoryMap::iterator i = factories_.find(scheme);
178 if (i != factories_.end()) { 178 if (i != factories_.end()) {
179 old_factory = i->second; 179 old_factory = i->second;
180 } else { 180 } else {
181 old_factory = NULL; 181 old_factory = NULL;
182 } 182 }
183 if (factory) { 183 if (factory) {
184 factories_[scheme] = factory; 184 factories_[scheme] = factory;
185 } else if (i != factories_.end()) { // uninstall any old one 185 } else if (i != factories_.end()) { // uninstall any old one
186 factories_.erase(i); 186 factories_.erase(i);
187 } 187 }
188 return old_factory; 188 return old_factory;
189 } 189 }
190 190
191 void URLRequestJobManager::RegisterRequestInterceptor( 191 void URLRequestJobManager::RegisterRequestInterceptor(
192 net::URLRequest::Interceptor* interceptor) { 192 net::URLRequest::Interceptor* interceptor) {
193 #ifndef NDEBUG 193 #ifndef NDEBUG
194 DCHECK(IsAllowedThread()); 194 DCHECK(IsAllowedThread());
195 #endif 195 #endif
196 196
197 AutoLock locked(lock_); 197 base::AutoLock locked(lock_);
198 198
199 DCHECK(std::find(interceptors_.begin(), interceptors_.end(), interceptor) == 199 DCHECK(std::find(interceptors_.begin(), interceptors_.end(), interceptor) ==
200 interceptors_.end()); 200 interceptors_.end());
201 interceptors_.push_back(interceptor); 201 interceptors_.push_back(interceptor);
202 } 202 }
203 203
204 void URLRequestJobManager::UnregisterRequestInterceptor( 204 void URLRequestJobManager::UnregisterRequestInterceptor(
205 net::URLRequest::Interceptor* interceptor) { 205 net::URLRequest::Interceptor* interceptor) {
206 #ifndef NDEBUG 206 #ifndef NDEBUG
207 DCHECK(IsAllowedThread()); 207 DCHECK(IsAllowedThread());
208 #endif 208 #endif
209 209
210 AutoLock locked(lock_); 210 base::AutoLock locked(lock_);
211 211
212 InterceptorList::iterator i = 212 InterceptorList::iterator i =
213 std::find(interceptors_.begin(), interceptors_.end(), interceptor); 213 std::find(interceptors_.begin(), interceptors_.end(), interceptor);
214 DCHECK(i != interceptors_.end()); 214 DCHECK(i != interceptors_.end());
215 interceptors_.erase(i); 215 interceptors_.erase(i);
216 } 216 }
217 217
218 } // namespace net 218 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_job_manager.h ('k') | printing/backend/print_backend_cups.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698