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

Side by Side Diff: content/child/mojo/mojo_application.h

Issue 1877743002: Use token-based initialisation for the utility process MojoApplication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Always use token init. Created 4 years, 8 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/child/child_thread_impl.cc ('k') | content/child/mojo/mojo_application.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CHILD_MOJO_MOJO_APPLICATION_H_ 5 #ifndef CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_
6 #define CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_ 6 #define CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_
7 7
8 #include <string>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "content/common/mojo/channel_init.h" 11 #include "content/common/mojo/channel_init.h"
10 #include "content/common/mojo/service_registry_impl.h" 12 #include "content/common/mojo/service_registry_impl.h"
11 #include "ipc/ipc_platform_file.h" 13 #include "ipc/ipc_platform_file.h"
14 #include "mojo/public/cpp/system/message_pipe.h"
12 15
13 namespace base { 16 namespace base {
14 class SequencedTaskRunner; 17 class SequencedTaskRunner;
15 } 18 }
16 19
17 namespace IPC { 20 namespace IPC {
18 class Message; 21 class Message;
19 } 22 }
20 23
21 namespace content { 24 namespace content {
22 25
23 // MojoApplication represents the code needed to setup a child process as a 26 // MojoApplication represents the code needed to setup a child process as a
24 // Mojo application via Chrome IPC. Instantiate MojoApplication and call its 27 // Mojo application via Chrome IPC. Instantiate MojoApplication and call its
25 // OnMessageReceived method to give it a shot at handling Chrome IPC messages. 28 // OnMessageReceived method to give it a shot at handling Chrome IPC messages.
26 // It makes the ServiceRegistry interface available. 29 // It makes the ServiceRegistry interface available.
27 class MojoApplication { 30 class MojoApplication {
28 public: 31 public:
29 explicit MojoApplication( 32 explicit MojoApplication(
30 scoped_refptr<base::SequencedTaskRunner> io_task_runner); 33 scoped_refptr<base::SequencedTaskRunner> io_task_runner);
31 virtual ~MojoApplication(); 34 virtual ~MojoApplication();
32 35
36 // TODO(amistry): Remove OnMessageReceived() when all bootstrapping has
37 // migrated to these functions.
38 void InitWithToken(std::string token);
39
33 bool OnMessageReceived(const IPC::Message& msg); 40 bool OnMessageReceived(const IPC::Message& msg);
34 41
35 ServiceRegistry* service_registry() { return &service_registry_; } 42 ServiceRegistry* service_registry() { return &service_registry_; }
36 43
37 private: 44 private:
38 void OnActivate(const IPC::PlatformFileForTransit& file); 45 void OnActivate(const IPC::PlatformFileForTransit& file);
39 46
40 scoped_refptr<base::SequencedTaskRunner> io_task_runner_; 47 scoped_refptr<base::SequencedTaskRunner> io_task_runner_;
41 ChannelInit channel_init_; 48 ChannelInit channel_init_;
42 ServiceRegistryImpl service_registry_; 49 ServiceRegistryImpl service_registry_;
43 50
44 DISALLOW_COPY_AND_ASSIGN(MojoApplication); 51 DISALLOW_COPY_AND_ASSIGN(MojoApplication);
45 }; 52 };
46 53
47 } // namespace content 54 } // namespace content
48 55
49 #endif // CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_ 56 #endif // CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | content/child/mojo/mojo_application.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698