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

Side by Side Diff: net/http/http_network_layer.cc

Issue 1367893003: Removing HttpNetworkLayer::CreateFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « net/http/http_network_layer.h ('k') | no next file » | 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) 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 #include "net/http/http_network_layer.h" 5 #include "net/http/http_network_layer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/power_monitor/power_monitor.h" 8 #include "base/power_monitor/power_monitor.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 HttpNetworkLayer::~HttpNetworkLayer() { 33 HttpNetworkLayer::~HttpNetworkLayer() {
34 #if defined(OS_WIN) 34 #if defined(OS_WIN)
35 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); 35 base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
36 if (power_monitor) 36 if (power_monitor)
37 power_monitor->RemoveObserver(this); 37 power_monitor->RemoveObserver(this);
38 #endif 38 #endif
39 } 39 }
40 40
41 // static
42 HttpTransactionFactory* HttpNetworkLayer::CreateFactory(
43 HttpNetworkSession* session) {
44 DCHECK(session);
45
46 return new HttpNetworkLayer(session);
47 }
48
49 int HttpNetworkLayer::CreateTransaction(RequestPriority priority, 41 int HttpNetworkLayer::CreateTransaction(RequestPriority priority,
50 scoped_ptr<HttpTransaction>* trans) { 42 scoped_ptr<HttpTransaction>* trans) {
51 if (suspended_) 43 if (suspended_)
52 return ERR_NETWORK_IO_SUSPENDED; 44 return ERR_NETWORK_IO_SUSPENDED;
53 45
54 trans->reset(new HttpNetworkTransaction(priority, GetSession())); 46 trans->reset(new HttpNetworkTransaction(priority, GetSession()));
55 return OK; 47 return OK;
56 } 48 }
57 49
58 HttpCache* HttpNetworkLayer::GetCache() { 50 HttpCache* HttpNetworkLayer::GetCache() {
59 return NULL; 51 return NULL;
60 } 52 }
61 53
62 HttpNetworkSession* HttpNetworkLayer::GetSession() { return session_.get(); } 54 HttpNetworkSession* HttpNetworkLayer::GetSession() { return session_.get(); }
63 55
64 void HttpNetworkLayer::OnSuspend() { 56 void HttpNetworkLayer::OnSuspend() {
65 suspended_ = true; 57 suspended_ = true;
66 58
67 if (session_.get()) 59 if (session_.get())
68 session_->CloseIdleConnections(); 60 session_->CloseIdleConnections();
69 } 61 }
70 62
71 void HttpNetworkLayer::OnResume() { 63 void HttpNetworkLayer::OnResume() {
72 suspended_ = false; 64 suspended_ = false;
73 } 65 }
74 66
75 } // namespace net 67 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698