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

Side by Side Diff: content/browser/mojo/mojo_child_connection.h

Issue 2201183003: Remove outgoing interface registry on RPH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/mojo/mojo_child_connection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ 5 #ifndef CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_
6 #define CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ 6 #define CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/process/process_handle.h" 14 #include "base/process/process_handle.h"
15 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
16 #include "services/shell/public/cpp/identity.h" 16 #include "services/shell/public/cpp/identity.h"
17 #include "services/shell/public/cpp/interface_provider.h" 17 #include "services/shell/public/cpp/interface_provider.h"
18 #include "services/shell/public/cpp/interface_registry.h"
19 #include "services/shell/public/interfaces/connector.mojom.h" 18 #include "services/shell/public/interfaces/connector.mojom.h"
20 19
21 #if defined(OS_ANDROID)
22 #include "content/public/browser/android/interface_registry_android.h"
23 #endif
24
25 namespace shell { 20 namespace shell {
26 class Connection; 21 class Connection;
27 class Connector; 22 class Connector;
28 } 23 }
29 24
30 namespace content { 25 namespace content {
31 26
32 // Helper class to establish a connection between the shell and a single child 27 // Helper class to establish a connection between the shell and a single child
33 // process. Process hosts can use this when launching new processes which 28 // process. Process hosts can use this when launching new processes which
34 // should be registered with the shell. 29 // should be registered with the shell.
35 class MojoChildConnection { 30 class MojoChildConnection {
36 public: 31 public:
37 // Prepares a new child connection for a child process which will be 32 // Prepares a new child connection for a child process which will be
38 // identified to the shell as |application_name|. |instance_id| must be 33 // identified to the shell as |application_name|. |instance_id| must be
39 // unique among all child connections using the same |application_name|. 34 // unique among all child connections using the same |application_name|.
40 // |connector| is the connector to use to establish the connection. 35 // |connector| is the connector to use to establish the connection.
41 MojoChildConnection(const std::string& application_name, 36 MojoChildConnection(const std::string& application_name,
42 const std::string& instance_id, 37 const std::string& instance_id,
43 const std::string& child_token, 38 const std::string& child_token,
44 shell::Connector* connector, 39 shell::Connector* connector,
45 scoped_refptr<base::SequencedTaskRunner> io_task_runner); 40 scoped_refptr<base::SequencedTaskRunner> io_task_runner);
46 ~MojoChildConnection(); 41 ~MojoChildConnection();
47 42
48 shell::InterfaceRegistry* GetInterfaceRegistry() {
49 return &interface_registry_;
50 }
51
52 shell::InterfaceProvider* GetRemoteInterfaces() { 43 shell::InterfaceProvider* GetRemoteInterfaces() {
53 return &remote_interfaces_; 44 return &remote_interfaces_;
54 } 45 }
55 46
56 const shell::Identity& child_identity() const { 47 const shell::Identity& child_identity() const {
57 return child_identity_; 48 return child_identity_;
58 } 49 }
59 50
60 // A token which must be passed to the child process via 51 // A token which must be passed to the child process via
61 // |switches::kPrimordialPipeToken| in order for the child to initialize its 52 // |switches::kPrimordialPipeToken| in order for the child to initialize its
62 // end of the shell connection pipe. 53 // end of the shell connection pipe.
63 std::string service_token() const { return service_token_; } 54 std::string service_token() const { return service_token_; }
64 55
65 // Sets the child connection's process handle. This should be called as soon 56 // Sets the child connection's process handle. This should be called as soon
66 // as the process has been launched, and the connection will not be fully 57 // as the process has been launched, and the connection will not be fully
67 // functional until this is called. 58 // functional until this is called.
68 void SetProcessHandle(base::ProcessHandle handle); 59 void SetProcessHandle(base::ProcessHandle handle);
69 60
70 private: 61 private:
71 class IOThreadContext; 62 class IOThreadContext;
72 63
73 void GetInterface(const mojo::String& interface_name,
74 mojo::ScopedMessagePipeHandle request_handle);
75
76 scoped_refptr<IOThreadContext> context_; 64 scoped_refptr<IOThreadContext> context_;
77 shell::Identity child_identity_; 65 shell::Identity child_identity_;
78 const std::string service_token_; 66 const std::string service_token_;
79 67
80 shell::InterfaceRegistry interface_registry_;
81 shell::InterfaceProvider remote_interfaces_; 68 shell::InterfaceProvider remote_interfaces_;
82 69
83 #if defined(OS_ANDROID)
84 std::unique_ptr<InterfaceRegistryAndroid> interface_registry_android_;
85 #endif
86
87 base::WeakPtrFactory<MojoChildConnection> weak_factory_; 70 base::WeakPtrFactory<MojoChildConnection> weak_factory_;
88 71
89 DISALLOW_COPY_AND_ASSIGN(MojoChildConnection); 72 DISALLOW_COPY_AND_ASSIGN(MojoChildConnection);
90 }; 73 };
91 74
92 } // namespace content 75 } // namespace content
93 76
94 #endif // CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ 77 #endif // CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/mojo/mojo_child_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698