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: chrome/test/chromedriver/server/chromedriver_server.cc

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: git rebase-update patch Created 4 years, 2 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <locale> 9 #include <locale>
10 #include <memory> 10 #include <memory>
(...skipping 21 matching lines...) Expand all
32 #include "base/threading/thread_local.h" 32 #include "base/threading/thread_local.h"
33 #include "base/threading/thread_task_runner_handle.h" 33 #include "base/threading/thread_task_runner_handle.h"
34 #include "build/build_config.h" 34 #include "build/build_config.h"
35 #include "chrome/test/chromedriver/logging.h" 35 #include "chrome/test/chromedriver/logging.h"
36 #include "chrome/test/chromedriver/net/port_server.h" 36 #include "chrome/test/chromedriver/net/port_server.h"
37 #include "chrome/test/chromedriver/server/http_handler.h" 37 #include "chrome/test/chromedriver/server/http_handler.h"
38 #include "chrome/test/chromedriver/version.h" 38 #include "chrome/test/chromedriver/version.h"
39 #include "net/base/ip_address.h" 39 #include "net/base/ip_address.h"
40 #include "net/base/ip_endpoint.h" 40 #include "net/base/ip_endpoint.h"
41 #include "net/base/net_errors.h" 41 #include "net/base/net_errors.h"
42 #include "net/log/net_log_source.h"
42 #include "net/server/http_server.h" 43 #include "net/server/http_server.h"
43 #include "net/server/http_server_request_info.h" 44 #include "net/server/http_server_request_info.h"
44 #include "net/server/http_server_response_info.h" 45 #include "net/server/http_server_response_info.h"
45 #include "net/socket/tcp_server_socket.h" 46 #include "net/socket/tcp_server_socket.h"
46 47
47 namespace { 48 namespace {
48 49
49 const int kBufferSize = 100 * 1024 * 1024; // 100 MB 50 const int kBufferSize = 100 * 1024 * 1024; // 100 MB
50 51
51 typedef base::Callback< 52 typedef base::Callback<
(...skipping 17 matching lines...) Expand all
69 class HttpServer : public net::HttpServer::Delegate { 70 class HttpServer : public net::HttpServer::Delegate {
70 public: 71 public:
71 explicit HttpServer(const HttpRequestHandlerFunc& handle_request_func) 72 explicit HttpServer(const HttpRequestHandlerFunc& handle_request_func)
72 : handle_request_func_(handle_request_func), 73 : handle_request_func_(handle_request_func),
73 weak_factory_(this) {} 74 weak_factory_(this) {}
74 75
75 ~HttpServer() override {} 76 ~HttpServer() override {}
76 77
77 bool Start(uint16_t port, bool allow_remote) { 78 bool Start(uint16_t port, bool allow_remote) {
78 std::unique_ptr<net::ServerSocket> server_socket( 79 std::unique_ptr<net::ServerSocket> server_socket(
79 new net::TCPServerSocket(NULL, net::NetLog::Source())); 80 new net::TCPServerSocket(NULL, net::NetLogSource()));
80 if (ListenOnIPv4(server_socket.get(), port, allow_remote) != net::OK) { 81 if (ListenOnIPv4(server_socket.get(), port, allow_remote) != net::OK) {
81 // This will work on an IPv6-only host, but we will be IPv4-only on 82 // This will work on an IPv6-only host, but we will be IPv4-only on
82 // dual-stack hosts. 83 // dual-stack hosts.
83 // TODO(samuong): change this to listen on both IPv4 and IPv6. 84 // TODO(samuong): change this to listen on both IPv4 and IPv6.
84 VLOG(0) << "listen on IPv4 failed, trying IPv6"; 85 VLOG(0) << "listen on IPv4 failed, trying IPv6";
85 if (ListenOnIPv6(server_socket.get(), port, allow_remote) != net::OK) { 86 if (ListenOnIPv6(server_socket.get(), port, allow_remote) != net::OK) {
86 VLOG(1) << "listen on both IPv4 and IPv6 failed, giving up"; 87 VLOG(1) << "listen on both IPv4 and IPv6 failed, giving up";
87 return false; 88 return false;
88 } 89 }
89 } 90 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 } 332 }
332 333
333 if (!InitLogging()) { 334 if (!InitLogging()) {
334 printf("Unable to initialize logging. Exiting...\n"); 335 printf("Unable to initialize logging. Exiting...\n");
335 return 1; 336 return 1;
336 } 337 }
337 RunServer(port, allow_remote, whitelisted_ips, url_base, adb_port, 338 RunServer(port, allow_remote, whitelisted_ips, url_base, adb_port,
338 std::move(port_server)); 339 std::move(port_server));
339 return 0; 340 return 0;
340 } 341 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698