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

Side by Side Diff: net/socket_stream/socket_stream_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
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/socket_stream/socket_stream_job_manager.h" 5 #include "net/socket_stream/socket_stream_job_manager.h"
6 6
7 #include "base/singleton.h" 7 #include "base/singleton.h"
8 8
9 namespace net { 9 namespace net {
10 10
(...skipping 13 matching lines...) Expand all
24 // If url is invalid, create plain SocketStreamJob, which will close 24 // If url is invalid, create plain SocketStreamJob, which will close
25 // the socket immediately. 25 // the socket immediately.
26 if (!url.is_valid()) { 26 if (!url.is_valid()) {
27 SocketStreamJob* job = new SocketStreamJob(); 27 SocketStreamJob* job = new SocketStreamJob();
28 job->InitSocketStream(new SocketStream(url, delegate)); 28 job->InitSocketStream(new SocketStream(url, delegate));
29 return job; 29 return job;
30 } 30 }
31 31
32 const std::string& scheme = url.scheme(); // already lowercase 32 const std::string& scheme = url.scheme(); // already lowercase
33 33
34 AutoLock locked(lock_); 34 base::AutoLock locked(lock_);
35 FactoryMap::const_iterator found = factories_.find(scheme); 35 FactoryMap::const_iterator found = factories_.find(scheme);
36 if (found != factories_.end()) { 36 if (found != factories_.end()) {
37 SocketStreamJob* job = found->second(url, delegate); 37 SocketStreamJob* job = found->second(url, delegate);
38 if (job) 38 if (job)
39 return job; 39 return job;
40 } 40 }
41 SocketStreamJob* job = new SocketStreamJob(); 41 SocketStreamJob* job = new SocketStreamJob();
42 job->InitSocketStream(new SocketStream(url, delegate)); 42 job->InitSocketStream(new SocketStream(url, delegate));
43 return job; 43 return job;
44 } 44 }
45 45
46 SocketStreamJob::ProtocolFactory* 46 SocketStreamJob::ProtocolFactory*
47 SocketStreamJobManager::RegisterProtocolFactory( 47 SocketStreamJobManager::RegisterProtocolFactory(
48 const std::string& scheme, SocketStreamJob::ProtocolFactory* factory) { 48 const std::string& scheme, SocketStreamJob::ProtocolFactory* factory) {
49 AutoLock locked(lock_); 49 base::AutoLock locked(lock_);
50 50
51 SocketStreamJob::ProtocolFactory* old_factory; 51 SocketStreamJob::ProtocolFactory* old_factory;
52 FactoryMap::iterator found = factories_.find(scheme); 52 FactoryMap::iterator found = factories_.find(scheme);
53 if (found != factories_.end()) { 53 if (found != factories_.end()) {
54 old_factory = found->second; 54 old_factory = found->second;
55 } else { 55 } else {
56 old_factory = NULL; 56 old_factory = NULL;
57 } 57 }
58 if (factory) { 58 if (factory) {
59 factories_[scheme] = factory; 59 factories_[scheme] = factory;
60 } else if (found != factories_.end()) { 60 } else if (found != factories_.end()) {
61 factories_.erase(found); 61 factories_.erase(found);
62 } 62 }
63 return old_factory; 63 return old_factory;
64 } 64 }
65 65
66 } // namespace net 66 } // namespace net
OLDNEW
« no previous file with comments | « net/socket_stream/socket_stream_job_manager.h ('k') | net/url_request/url_request_job_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698