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

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

Issue 2226403002: Remove Channel token from InProcessChildThreadParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moar-channels
Patch Set: rebase 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_
6 #define CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/process/process_handle.h"
15 #include "base/sequenced_task_runner.h"
16 #include "services/shell/public/cpp/identity.h"
17 #include "services/shell/public/cpp/interface_provider.h"
18 #include "services/shell/public/interfaces/connector.mojom.h"
19
20 namespace shell {
21 class Connection;
22 class Connector;
23 }
24
25 namespace content {
26
27 // Helper class to establish a connection between the shell and a single child
28 // process. Process hosts can use this when launching new processes which
29 // should be registered with the shell.
30 class MojoChildConnection {
31 public:
32 // Prepares a new child connection for a child process which will be
33 // identified to the shell as |application_name|. |instance_id| must be
34 // unique among all child connections using the same |application_name|.
35 // |connector| is the connector to use to establish the connection.
36 MojoChildConnection(const std::string& application_name,
37 const std::string& instance_id,
38 const std::string& child_token,
39 shell::Connector* connector,
40 scoped_refptr<base::SequencedTaskRunner> io_task_runner);
41 ~MojoChildConnection();
42
43 shell::InterfaceProvider* GetRemoteInterfaces() {
44 return &remote_interfaces_;
45 }
46
47 const shell::Identity& child_identity() const {
48 return child_identity_;
49 }
50
51 // A token which must be passed to the child process via
52 // |switches::kPrimordialPipeToken| in order for the child to initialize its
53 // end of the shell connection pipe.
54 std::string service_token() const { return service_token_; }
55
56 // Sets the child connection's process handle. This should be called as soon
57 // as the process has been launched, and the connection will not be fully
58 // functional until this is called.
59 void SetProcessHandle(base::ProcessHandle handle);
60
61 private:
62 class IOThreadContext;
63
64 scoped_refptr<IOThreadContext> context_;
65 shell::Identity child_identity_;
66 const std::string service_token_;
67
68 shell::InterfaceProvider remote_interfaces_;
69
70 base::WeakPtrFactory<MojoChildConnection> weak_factory_;
71
72 DISALLOW_COPY_AND_ASSIGN(MojoChildConnection);
73 };
74
75 } // namespace content
76
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