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

Side by Side Diff: ipc/ipc_channel.h

Issue 2668153003: Mojo C++ Bindings: Eliminate unbound ThreadSafeInterfacePtr (Closed)
Patch Set: format and rebase... Created 3 years, 10 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 | « ipc/BUILD.gn ('k') | ipc/ipc_channel_mojo.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 IPC_IPC_CHANNEL_H_ 5 #ifndef IPC_IPC_CHANNEL_H_
6 #define IPC_IPC_CHANNEL_H_ 6 #define IPC_IPC_CHANNEL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/files/scoped_file.h" 15 #include "base/files/scoped_file.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/process/process.h" 17 #include "base/process/process.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "ipc/ipc.mojom.h"
21 #include "ipc/ipc_channel_handle.h" 22 #include "ipc/ipc_channel_handle.h"
22 #include "ipc/ipc_message.h" 23 #include "ipc/ipc_message.h"
23 #include "ipc/ipc_sender.h" 24 #include "ipc/ipc_sender.h"
24 #include "mojo/public/cpp/bindings/associated_group.h" 25 #include "mojo/public/cpp/bindings/associated_group.h"
25 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" 26 #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
26 #include "mojo/public/cpp/bindings/associated_interface_request.h" 27 #include "mojo/public/cpp/bindings/associated_interface_request.h"
27 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" 28 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
29 #include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h"
28 30
29 #if defined(OS_POSIX) 31 #if defined(OS_POSIX)
30 #include <sys/types.h> 32 #include <sys/types.h>
31 #endif 33 #endif
32 34
33 namespace IPC { 35 namespace IPC {
34 36
35 class Listener; 37 class Listener;
36 38
37 //------------------------------------------------------------------------------ 39 //------------------------------------------------------------------------------
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 public: 89 public:
88 using GenericAssociatedInterfaceFactory = 90 using GenericAssociatedInterfaceFactory =
89 base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>; 91 base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>;
90 92
91 virtual ~AssociatedInterfaceSupport() {} 93 virtual ~AssociatedInterfaceSupport() {}
92 94
93 // Accesses the AssociatedGroup used to associate new interface endpoints 95 // Accesses the AssociatedGroup used to associate new interface endpoints
94 // with this Channel. Must be safe to call from any thread. 96 // with this Channel. Must be safe to call from any thread.
95 virtual mojo::AssociatedGroup* GetAssociatedGroup() = 0; 97 virtual mojo::AssociatedGroup* GetAssociatedGroup() = 0;
96 98
99 // Returns a ThreadSafeForwarded for this channel which can be used to
100 // safely send mojom::Channel requests from arbitrary threads.
101 virtual std::unique_ptr<mojo::ThreadSafeForwarder<mojom::Channel>>
102 CreateThreadSafeChannel() = 0;
103
97 // Adds an interface factory to this channel for interface |name|. Must be 104 // Adds an interface factory to this channel for interface |name|. Must be
98 // safe to call from any thread. 105 // safe to call from any thread.
99 virtual void AddGenericAssociatedInterface( 106 virtual void AddGenericAssociatedInterface(
100 const std::string& name, 107 const std::string& name,
101 const GenericAssociatedInterfaceFactory& factory) = 0; 108 const GenericAssociatedInterfaceFactory& factory) = 0;
102 109
103 // Requests an associated interface from the remote endpoint. 110 // Requests an associated interface from the remote endpoint.
104 virtual void GetGenericRemoteAssociatedInterface( 111 virtual void GetGenericRemoteAssociatedInterface(
105 const std::string& name, 112 const std::string& name,
106 mojo::ScopedInterfaceEndpointHandle handle) = 0; 113 mojo::ScopedInterfaceEndpointHandle handle) = 0;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // of Connect(). 285 // of Connect().
279 void WillConnect(); 286 void WillConnect();
280 287
281 private: 288 private:
282 bool did_start_connect_ = false; 289 bool did_start_connect_ = false;
283 }; 290 };
284 291
285 } // namespace IPC 292 } // namespace IPC
286 293
287 #endif // IPC_IPC_CHANNEL_H_ 294 #endif // IPC_IPC_CHANNEL_H_
OLDNEW
« no previous file with comments | « ipc/BUILD.gn ('k') | ipc/ipc_channel_mojo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698