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

Side by Side Diff: services/http_server/http_server_factory_impl.cc

Issue 2012873003: More ApplicationDelegate/ApplicationRunner[Chromium] conversion. (Closed) Base URL: https://github.com/domokit/mojo.git@work791_run_app_options
Patch Set: Created 4 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "services/http_server/http_server_factory_impl.h" 5 #include "services/http_server/http_server_factory_impl.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "mojo/services/http_server/interfaces/http_server.mojom.h" 8 #include "mojo/services/http_server/interfaces/http_server.mojom.h"
9 #include "services/http_server/http_server_impl.h" 9 #include "services/http_server/http_server_impl.h"
10 10
11 namespace http_server { 11 namespace http_server {
12 12
13 HttpServerFactoryImpl::HttpServerFactoryImpl(mojo::ApplicationImpl* app) { 13 HttpServerFactoryImpl::HttpServerFactoryImpl(mojo::Shell* shell)
14 app_ = app; 14 : shell_(shell) {}
15 }
16 15
17 HttpServerFactoryImpl::~HttpServerFactoryImpl() { 16 HttpServerFactoryImpl::~HttpServerFactoryImpl() {
18 // Free the http servers. 17 // Free the http servers.
19 STLDeleteContainerPairSecondPointers(port_indicated_servers_.begin(), 18 STLDeleteContainerPairSecondPointers(port_indicated_servers_.begin(),
20 port_indicated_servers_.end()); 19 port_indicated_servers_.end());
21 STLDeleteContainerPointers(port_any_servers_.begin(), 20 STLDeleteContainerPointers(port_any_servers_.begin(),
22 port_any_servers_.end()); 21 port_any_servers_.end());
23 } 22 }
24 23
25 void HttpServerFactoryImpl::AddBinding( 24 void HttpServerFactoryImpl::AddBinding(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 local_address->ipv4->addr[1] = 0; 69 local_address->ipv4->addr[1] = 0;
71 local_address->ipv4->addr[2] = 0; 70 local_address->ipv4->addr[2] = 0;
72 local_address->ipv4->addr[3] = 0; 71 local_address->ipv4->addr[3] = 0;
73 local_address->ipv4->port = 0; 72 local_address->ipv4->port = 0;
74 } 73 }
75 ServerKey key = GetServerKey(local_address.get()); 74 ServerKey key = GetServerKey(local_address.get());
76 75
77 if (key.second) { // If the port is non-zero. 76 if (key.second) { // If the port is non-zero.
78 if (!port_indicated_servers_.count(key)) { 77 if (!port_indicated_servers_.count(key)) {
79 port_indicated_servers_[key] = 78 port_indicated_servers_[key] =
80 new HttpServerImpl(app_, this, local_address.Pass()); 79 new HttpServerImpl(shell_, this, local_address.Pass());
81 } 80 }
82 port_indicated_servers_[key]->AddBinding(server_request.Pass()); 81 port_indicated_servers_[key]->AddBinding(server_request.Pass());
83 } else { 82 } else {
84 HttpServerImpl* server = 83 HttpServerImpl* server =
85 new HttpServerImpl(app_, this, local_address.Pass()); 84 new HttpServerImpl(shell_, this, local_address.Pass());
86 server->AddBinding(server_request.Pass()); 85 server->AddBinding(server_request.Pass());
87 port_any_servers_.insert(server); 86 port_any_servers_.insert(server);
88 } 87 }
89 } 88 }
90 89
91 } // namespace http_server 90 } // namespace http_server
OLDNEW
« no previous file with comments | « services/http_server/http_server_factory_impl.h ('k') | services/http_server/http_server_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698