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

Side by Side Diff: android_webview/native/aw_dev_tools_server.cc

Issue 1552723002: Convert Pass()→std::move() in //android_webview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "android_webview/native/aw_dev_tools_server.h" 5 #include "android_webview/native/aw_dev_tools_server.h"
6 6
7 #include <utility>
8
7 #include "android_webview/common/aw_content_client.h" 9 #include "android_webview/common/aw_content_client.h"
8 #include "android_webview/native/aw_contents.h" 10 #include "android_webview/native/aw_contents.h"
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
11 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
12 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
14 #include "base/values.h" 16 #include "base/values.h"
15 #include "components/devtools_http_handler/devtools_http_handler.h" 17 #include "components/devtools_http_handler/devtools_http_handler.h"
16 #include "components/devtools_http_handler/devtools_http_handler_delegate.h" 18 #include "components/devtools_http_handler/devtools_http_handler_delegate.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 109
108 scoped_ptr<net::ServerSocket> CreateForTethering(std::string* name) override { 110 scoped_ptr<net::ServerSocket> CreateForTethering(std::string* name) override {
109 *name = base::StringPrintf( 111 *name = base::StringPrintf(
110 kTetheringSocketName, getpid(), ++last_tethering_socket_); 112 kTetheringSocketName, getpid(), ++last_tethering_socket_);
111 scoped_ptr<net::UnixDomainServerSocket> socket( 113 scoped_ptr<net::UnixDomainServerSocket> socket(
112 new net::UnixDomainServerSocket( 114 new net::UnixDomainServerSocket(
113 base::Bind(&content::CanUserConnectToDevTools), true)); 115 base::Bind(&content::CanUserConnectToDevTools), true));
114 if (socket->ListenWithAddressAndPort(*name, 0, kBackLog) != net::OK) 116 if (socket->ListenWithAddressAndPort(*name, 0, kBackLog) != net::OK)
115 return scoped_ptr<net::ServerSocket>(); 117 return scoped_ptr<net::ServerSocket>();
116 118
117 return socket.Pass(); 119 return std::move(socket);
118 } 120 }
119 121
120 std::string socket_name_; 122 std::string socket_name_;
121 int last_tethering_socket_; 123 int last_tethering_socket_;
122 124
123 DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocketFactory); 125 DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocketFactory);
124 }; 126 };
125 127
126 } // namespace 128 } // namespace
127 129
128 namespace android_webview { 130 namespace android_webview {
129 131
130 AwDevToolsServer::AwDevToolsServer() { 132 AwDevToolsServer::AwDevToolsServer() {
131 } 133 }
132 134
133 AwDevToolsServer::~AwDevToolsServer() { 135 AwDevToolsServer::~AwDevToolsServer() {
134 Stop(); 136 Stop();
135 } 137 }
136 138
137 void AwDevToolsServer::Start() { 139 void AwDevToolsServer::Start() {
138 if (devtools_http_handler_) 140 if (devtools_http_handler_)
139 return; 141 return;
140 142
141 scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> factory( 143 scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> factory(
142 new UnixDomainServerSocketFactory( 144 new UnixDomainServerSocketFactory(
143 base::StringPrintf(kSocketNameFormat, getpid()))); 145 base::StringPrintf(kSocketNameFormat, getpid())));
144 devtools_http_handler_.reset(new DevToolsHttpHandler( 146 devtools_http_handler_.reset(new DevToolsHttpHandler(
145 factory.Pass(), 147 std::move(factory),
146 base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()), 148 base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()),
147 new AwDevToolsServerDelegate(), 149 new AwDevToolsServerDelegate(), base::FilePath(), base::FilePath(),
148 base::FilePath(), 150 GetProduct(), GetUserAgent()));
149 base::FilePath(),
150 GetProduct(),
151 GetUserAgent()));
152 } 151 }
153 152
154 void AwDevToolsServer::Stop() { 153 void AwDevToolsServer::Stop() {
155 devtools_http_handler_.reset(); 154 devtools_http_handler_.reset();
156 } 155 }
157 156
158 bool AwDevToolsServer::IsStarted() const { 157 bool AwDevToolsServer::IsStarted() const {
159 return devtools_http_handler_; 158 return devtools_http_handler_;
160 } 159 }
161 160
(...skipping 20 matching lines...) Expand all
182 AwDevToolsServer* devtools_server = 181 AwDevToolsServer* devtools_server =
183 reinterpret_cast<AwDevToolsServer*>(server); 182 reinterpret_cast<AwDevToolsServer*>(server);
184 if (enabled) { 183 if (enabled) {
185 devtools_server->Start(); 184 devtools_server->Start();
186 } else { 185 } else {
187 devtools_server->Stop(); 186 devtools_server->Stop();
188 } 187 }
189 } 188 }
190 189
191 } // namespace android_webview 190 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents_io_thread_client_impl.cc ('k') | android_webview/native/aw_web_contents_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698