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

Side by Side Diff: mojo/edk/system/child_broker.h

Issue 1598223004: Revert of [mojo] Add CreateSharedBuffer method to Broker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: presubmits Created 4 years, 11 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 | « mojo/edk/system/broker_state.cc ('k') | mojo/edk/system/child_broker.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 MOJO_EDK_SYSTEM_CHILD_BROKER_H_ 5 #ifndef MOJO_EDK_SYSTEM_CHILD_BROKER_H_
6 #define MOJO_EDK_SYSTEM_CHILD_BROKER_H_ 6 #define MOJO_EDK_SYSTEM_CHILD_BROKER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 28 matching lines...) Expand all
39 // Broker implementation: 39 // Broker implementation:
40 #if defined(OS_WIN) 40 #if defined(OS_WIN)
41 void CreatePlatformChannelPair(ScopedPlatformHandle* server, 41 void CreatePlatformChannelPair(ScopedPlatformHandle* server,
42 ScopedPlatformHandle* client) override; 42 ScopedPlatformHandle* client) override;
43 void HandleToToken(const PlatformHandle* platform_handles, 43 void HandleToToken(const PlatformHandle* platform_handles,
44 size_t count, 44 size_t count,
45 uint64_t* tokens) override; 45 uint64_t* tokens) override;
46 void TokenToHandle(const uint64_t* tokens, 46 void TokenToHandle(const uint64_t* tokens,
47 size_t count, 47 size_t count,
48 PlatformHandle* handles) override; 48 PlatformHandle* handles) override;
49 #else
50 scoped_refptr<PlatformSharedBuffer> CreateSharedBuffer(
51 size_t num_bytes) override;
52 #endif 49 #endif
53
54 void ConnectMessagePipe(uint64_t pipe_id, 50 void ConnectMessagePipe(uint64_t pipe_id,
55 MessagePipeDispatcher* message_pipe) override; 51 MessagePipeDispatcher* message_pipe) override;
56 void CloseMessagePipe(uint64_t pipe_id, 52 void CloseMessagePipe(uint64_t pipe_id,
57 MessagePipeDispatcher* message_pipe) override; 53 MessagePipeDispatcher* message_pipe) override;
58 54
59 private: 55 private:
60 friend struct base::DefaultSingletonTraits<ChildBroker>; 56 friend struct base::DefaultSingletonTraits<ChildBroker>;
61 57
62 ChildBroker(); 58 ChildBroker();
63 ~ChildBroker() override; 59 ~ChildBroker() override;
(...skipping 20 matching lines...) Expand all
84 80
85 #if defined(OS_WIN) 81 #if defined(OS_WIN)
86 // Helper method to write the given message and read back the result. 82 // Helper method to write the given message and read back the result.
87 bool WriteAndReadResponse(BrokerMessage* message, 83 bool WriteAndReadResponse(BrokerMessage* message,
88 void* response, 84 void* response,
89 uint32_t response_size); 85 uint32_t response_size);
90 86
91 void CreatePlatformChannelPairNoLock(ScopedPlatformHandle* server, 87 void CreatePlatformChannelPairNoLock(ScopedPlatformHandle* server,
92 ScopedPlatformHandle* client); 88 ScopedPlatformHandle* client);
93 89
94 #else
95 // Will fully write |message|, then read back some number of handles. Returns
96 // false if the write or read failed, or if there were no handles received.
97 bool WriteAndReadHandles(BrokerMessage* message,
98 std::deque<PlatformHandle>* handles);
99 #endif
100
101 // Guards access to |parent_sync_channel_|. 90 // Guards access to |parent_sync_channel_|.
102 // We use LockImpl instead of Lock because the latter adds thread checking 91 // We use LockImpl instead of Lock because the latter adds thread checking
103 // that we don't want (since we lock in the constructor and unlock on another 92 // that we don't want (since we lock in the constructor and unlock on another
104 // thread. 93 // thread.
105 base::internal::LockImpl sync_channel_lock_; 94 base::internal::LockImpl sync_channel_lock_;
106 95
107 // Pipe used for communication to the parent process. We use a pipe directly 96 // Pipe used for communication to the parent process. We use a pipe directly
108 // instead of bindings or RawChannel because we need to send synchronous 97 // instead of bindings or RawChannel because we need to send synchronous
109 // messages with replies from any thread. 98 // messages with replies from any thread.
110 ScopedPlatformHandle parent_sync_channel_; 99 ScopedPlatformHandle parent_sync_channel_;
100 #endif
111 101
112 // RawChannel used for asynchronous communication to and from the parent 102 // RawChannel used for asynchronous communication to and from the parent
113 // process. Since these messages are bidirectional, we can't use 103 // process. Since these messages are bidirectional, we can't use
114 // |parent_sync_channel_| which is only used for sync messages to the parent. 104 // |parent_sync_channel_| which is only used for sync messages to the parent.
115 // However since the messages are asynchronous, we can use RawChannel for 105 // However since the messages are asynchronous, we can use RawChannel for
116 // convenience instead of writing and reading from pipes manually. Although it 106 // convenience instead of writing and reading from pipes manually. Although it
117 // would be convenient, we don't use Mojo IPC because it would be a layering 107 // would be convenient, we don't use Mojo IPC because it would be a layering
118 // violation (and cirular dependency) if the system layer depended on 108 // violation (and cirular dependency) if the system layer depended on
119 // bindings. 109 // bindings.
120 RoutedRawChannel* parent_async_channel_; 110 RoutedRawChannel* parent_async_channel_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 RoutedRawChannel* in_process_pipes_channel1_; 142 RoutedRawChannel* in_process_pipes_channel1_;
153 RoutedRawChannel* in_process_pipes_channel2_; 143 RoutedRawChannel* in_process_pipes_channel2_;
154 144
155 DISALLOW_COPY_AND_ASSIGN(ChildBroker); 145 DISALLOW_COPY_AND_ASSIGN(ChildBroker);
156 }; 146 };
157 147
158 } // namespace edk 148 } // namespace edk
159 } // namespace mojo 149 } // namespace mojo
160 150
161 #endif // MOJO_EDK_SYSTEM_CHILD_BROKER_H_ 151 #endif // MOJO_EDK_SYSTEM_CHILD_BROKER_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/broker_state.cc ('k') | mojo/edk/system/child_broker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698