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

Side by Side Diff: net/socket_stream/socket_stream_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) 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 namespace net { 7 namespace net {
8 8
9 SocketStreamJobManager::SocketStreamJobManager() { 9 SocketStreamJobManager::SocketStreamJobManager() {
10 } 10 }
11 11
12 SocketStreamJobManager::~SocketStreamJobManager() { 12 SocketStreamJobManager::~SocketStreamJobManager() {
13 } 13 }
14 14
15 // static
16 SocketStreamJobManager* SocketStreamJobManager::GetInstance() {
17 return Singleton<SocketStreamJobManager>::get();
18 }
19
15 SocketStreamJob* SocketStreamJobManager::CreateJob( 20 SocketStreamJob* SocketStreamJobManager::CreateJob(
16 const GURL& url, SocketStream::Delegate* delegate) const { 21 const GURL& url, SocketStream::Delegate* delegate) const {
17 // If url is invalid, create plain SocketStreamJob, which will close 22 // If url is invalid, create plain SocketStreamJob, which will close
18 // the socket immediately. 23 // the socket immediately.
19 if (!url.is_valid()) { 24 if (!url.is_valid()) {
20 SocketStreamJob* job = new SocketStreamJob(); 25 SocketStreamJob* job = new SocketStreamJob();
21 job->InitSocketStream(new SocketStream(url, delegate)); 26 job->InitSocketStream(new SocketStream(url, delegate));
22 return job; 27 return job;
23 } 28 }
24 29
(...skipping 25 matching lines...) Expand all
50 } 55 }
51 if (factory) { 56 if (factory) {
52 factories_[scheme] = factory; 57 factories_[scheme] = factory;
53 } else if (found != factories_.end()) { 58 } else if (found != factories_.end()) {
54 factories_.erase(found); 59 factories_.erase(found);
55 } 60 }
56 return old_factory; 61 return old_factory;
57 } 62 }
58 63
59 } // namespace net 64 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698