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

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

Issue 2398783002: Rename a bunch of Mojo Application stuff to reference Services. (Closed)
Patch Set: . 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
(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_COMMON_MOJO_MOJO_CHILD_CONNECTION_H_
6 #define CONTENT_COMMON_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 "content/common/content_export.h"
17 #include "services/shell/public/cpp/identity.h"
18 #include "services/shell/public/cpp/interface_provider.h"
19 #include "services/shell/public/interfaces/connector.mojom.h"
20
21 namespace shell {
22 class Connection;
23 class Connector;
24 }
25
26 namespace content {
27
28 // Helper class to establish a connection between the shell and a single child
29 // process. Process hosts can use this when launching new processes which
30 // should be registered with the shell.
31 class CONTENT_EXPORT MojoChildConnection {
32 public:
33 // Prepares a new child connection for a child process which will be
34 // identified to the shell as |application_name|. |instance_id| must be
35 // unique among all child connections using the same |application_name|.
36 // |connector| is the connector to use to establish the connection.
37 MojoChildConnection(const std::string& application_name,
38 const std::string& instance_id,
39 const std::string& child_token,
40 shell::Connector* connector,
41 scoped_refptr<base::SequencedTaskRunner> io_task_runner);
42 ~MojoChildConnection();
43
44 shell::InterfaceProvider* GetRemoteInterfaces() {
45 return &remote_interfaces_;
46 }
47
48 const shell::Identity& child_identity() const {
49 return child_identity_;
50 }
51
52 // A token which must be passed to the child process via
53 // |switches::kPrimordialPipeToken| in order for the child to initialize its
54 // end of the shell connection pipe.
55 std::string service_token() const { return service_token_; }
56
57 // Sets the child connection's process handle. This should be called as soon
58 // as the process has been launched, and the connection will not be fully
59 // functional until this is called.
60 void SetProcessHandle(base::ProcessHandle handle);
61
62 private:
63 class IOThreadContext;
64
65 scoped_refptr<IOThreadContext> context_;
66 shell::Identity child_identity_;
67 const std::string service_token_;
68
69 shell::InterfaceProvider remote_interfaces_;
70
71 base::WeakPtrFactory<MojoChildConnection> weak_factory_;
72
73 DISALLOW_COPY_AND_ASSIGN(MojoChildConnection);
74 };
75
76 } // namespace content
77
78 #endif // CONTENT_COMMON_MOJO_MOJO_CHILD_CONNECTION_H_
OLDNEW
« no previous file with comments | « content/common/mojo/embedded_application_runner.cc ('k') | content/common/mojo/mojo_child_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698