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

Side by Side Diff: services/http_server/http_server_impl.h

Issue 1682113003: Mojo C++ bindings: Generate InterfaceHandle<> instead of InterfacePtr<>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "mojo/common/binding_set.h" 8 #include "mojo/common/binding_set.h"
9 #include "mojo/public/cpp/bindings/interface_handle.h"
9 #include "mojo/public/cpp/bindings/interface_request.h" 10 #include "mojo/public/cpp/bindings/interface_request.h"
10 #include "mojo/public/cpp/bindings/strong_binding.h" 11 #include "mojo/public/cpp/bindings/strong_binding.h"
11 #include "mojo/services/http_server/interfaces/http_request.mojom.h" 12 #include "mojo/services/http_server/interfaces/http_request.mojom.h"
12 #include "mojo/services/http_server/interfaces/http_response.mojom.h" 13 #include "mojo/services/http_server/interfaces/http_response.mojom.h"
13 #include "mojo/services/http_server/interfaces/http_server.mojom.h" 14 #include "mojo/services/http_server/interfaces/http_server.mojom.h"
14 #include "mojo/services/network/interfaces/net_address.mojom.h" 15 #include "mojo/services/network/interfaces/net_address.mojom.h"
15 #include "mojo/services/network/interfaces/network_service.mojom.h" 16 #include "mojo/services/network/interfaces/network_service.mojom.h"
16 #include "third_party/re2/re2/re2.h" 17 #include "third_party/re2/re2/re2.h"
17 18
18 namespace mojo { 19 namespace mojo {
19 class ApplicationImpl; 20 class ApplicationImpl;
20 } // namespace mojo 21 } // namespace mojo
21 22
22 namespace http_server { 23 namespace http_server {
23 24
24 class Connection; 25 class Connection;
25 class HttpServerFactoryImpl; 26 class HttpServerFactoryImpl;
26 27
27 class HttpServerImpl : public HttpServer { 28 class HttpServerImpl : public HttpServer {
28 public: 29 public:
29 HttpServerImpl(mojo::ApplicationImpl* app, 30 HttpServerImpl(mojo::ApplicationImpl* app,
30 HttpServerFactoryImpl* factory, 31 HttpServerFactoryImpl* factory,
31 mojo::NetAddressPtr requested_local_address); 32 mojo::NetAddressPtr requested_local_address);
32 ~HttpServerImpl() override; 33 ~HttpServerImpl() override;
33 34
34 void AddBinding(mojo::InterfaceRequest<HttpServer> request); 35 void AddBinding(mojo::InterfaceRequest<HttpServer> request);
35 36
36 // HttpServer: 37 // HttpServer:
37 void SetHandler(const mojo::String& path, 38 void SetHandler(const mojo::String& path,
38 HttpHandlerPtr http_handler, 39 mojo::InterfaceHandle<HttpHandler> http_handler,
39 const mojo::Callback<void(bool)>& callback) override; 40 const mojo::Callback<void(bool)>& callback) override;
40 41
41 void GetPort(const GetPortCallback& callback) override; 42 void GetPort(const GetPortCallback& callback) override;
42 43
43 private: 44 private:
44 struct Handler { 45 struct Handler {
45 Handler(const std::string& pattern, HttpHandlerPtr http_handler); 46 Handler(const std::string& pattern, HttpHandlerPtr http_handler);
46 ~Handler(); 47 ~Handler();
47 scoped_ptr<re2::RE2> pattern; 48 scoped_ptr<re2::RE2> pattern;
48 HttpHandlerPtr http_handler; 49 HttpHandlerPtr http_handler;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 88
88 // TODO(vtl): Maybe this should be an std::set or unordered_set, which would 89 // TODO(vtl): Maybe this should be an std::set or unordered_set, which would
89 // simplify OnHandlerConnectionError(). 90 // simplify OnHandlerConnectionError().
90 ScopedVector<Handler> handlers_; 91 ScopedVector<Handler> handlers_;
91 92
92 base::WeakPtrFactory<HttpServerImpl> weak_ptr_factory_; 93 base::WeakPtrFactory<HttpServerImpl> weak_ptr_factory_;
93 DISALLOW_COPY_AND_ASSIGN(HttpServerImpl); 94 DISALLOW_COPY_AND_ASSIGN(HttpServerImpl);
94 }; 95 };
95 96
96 } // namespace http_server 97 } // namespace http_server
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698