Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ | 5 #ifndef CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ |
| 6 #define CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ | 6 #define CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/process/process_handle.h" | 12 #include "base/process/process_handle.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "content/common/application_setup.mojom.h" | 14 #include "content/common/application_setup.mojom.h" |
| 14 #include "content/common/mojo/channel_init.h" | 15 #include "content/common/mojo/channel_init.h" |
| 15 #include "content/common/mojo/service_registry_impl.h" | 16 #include "content/common/mojo/service_registry_impl.h" |
| 16 #include "mojo/edk/embedder/scoped_platform_handle.h" | 17 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 17 #include "mojo/public/cpp/system/message_pipe.h" | 18 #include "mojo/public/cpp/system/message_pipe.h" |
| 18 | 19 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 35 public: | 36 public: |
| 36 MojoApplicationHost(); | 37 MojoApplicationHost(); |
| 37 ~MojoApplicationHost(); | 38 ~MojoApplicationHost(); |
| 38 | 39 |
| 39 // Two-phase initialization: | 40 // Two-phase initialization: |
| 40 // 1- Init makes service_registry() available synchronously. | 41 // 1- Init makes service_registry() available synchronously. |
| 41 // 2- Activate establishes the actual connection to the peer process. | 42 // 2- Activate establishes the actual connection to the peer process. |
| 42 bool Init(); | 43 bool Init(); |
| 43 void Activate(IPC::Sender* sender, base::ProcessHandle process_handle); | 44 void Activate(IPC::Sender* sender, base::ProcessHandle process_handle); |
| 44 | 45 |
| 46 // Use a shared token to initialize the application. Returns a token to pass | |
| 47 // to the child process. | |
| 48 std::string InitWithToken(); | |
| 49 | |
| 50 // Use a message pipe to initialize the application. Used for in-process child | |
| 51 // threads. | |
| 52 mojo::ScopedMessagePipeHandle InitWithPipe(); | |
|
Ken Rockot(use gerrit already)
2016/04/11 15:04:18
Did you try simply using the token for the in-proc
Anand Mistry (off Chromium)
2016/04/12 00:31:14
I did separate approaches after chatting with Sam
| |
| 53 | |
| 45 ServiceRegistry* service_registry() { return &service_registry_; } | 54 ServiceRegistry* service_registry() { return &service_registry_; } |
| 46 | 55 |
| 47 #if defined(OS_ANDROID) | 56 #if defined(OS_ANDROID) |
| 48 ServiceRegistryAndroid* service_registry_android() { | 57 ServiceRegistryAndroid* service_registry_android() { |
| 49 return service_registry_android_.get(); | 58 return service_registry_android_.get(); |
| 50 } | 59 } |
| 51 #endif | 60 #endif |
| 52 | 61 |
| 53 void OverrideIOTaskRunnerForTest( | 62 void OverrideIOTaskRunnerForTest( |
| 54 scoped_refptr<base::TaskRunner> io_task_runner); | 63 scoped_refptr<base::TaskRunner> io_task_runner); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 67 #if defined(OS_ANDROID) | 76 #if defined(OS_ANDROID) |
| 68 std::unique_ptr<ServiceRegistryAndroid> service_registry_android_; | 77 std::unique_ptr<ServiceRegistryAndroid> service_registry_android_; |
| 69 #endif | 78 #endif |
| 70 | 79 |
| 71 DISALLOW_COPY_AND_ASSIGN(MojoApplicationHost); | 80 DISALLOW_COPY_AND_ASSIGN(MojoApplicationHost); |
| 72 }; | 81 }; |
| 73 | 82 |
| 74 } // namespace content | 83 } // namespace content |
| 75 | 84 |
| 76 #endif // CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ | 85 #endif // CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ |
| OLD | NEW |