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

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

Issue 1465183005: Rename mojo::TokenSerializer to mojo::Broker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win component Created 5 years 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
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_TOKEN_SERIALIZER_WIN_H_ 5 #ifndef MOJO_EDK_SYSTEM_CHILD_BROKER_H_
6 #define MOJO_EDK_SYSTEM_CHILD_TOKEN_SERIALIZER_WIN_H_ 6 #define MOJO_EDK_SYSTEM_CHILD_BROKER_H_
7 7
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/synchronization/lock_impl.h" 9 #include "base/synchronization/lock_impl.h"
10 #include "mojo/edk/embedder/scoped_platform_handle.h" 10 #include "mojo/edk/embedder/scoped_platform_handle.h"
11 #include "mojo/edk/system/broker.h"
11 #include "mojo/edk/system/system_impl_export.h" 12 #include "mojo/edk/system/system_impl_export.h"
12 #include "mojo/edk/system/token_serializer_win.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace edk { 15 namespace edk {
16 struct TokenSerializerMessage; 16 struct BrokerMessage;
17 17
18 // An implementation of TokenSerializer used in (sandboxed) child processes. It 18 // An implementation of Broker used in (sandboxed) child processes. It talks
19 // talks over sync IPCs to the (unsandboxed) parent process (specifically, 19 // over sync IPCs to the (unsandboxed) parent process (specifically,
20 // ParentTokenSerializer) to convert handles to tokens and vice versa. 20 // ParentBroker) to convert handles to tokens and vice versa.
yzshen1 2015/11/25 16:47:09 nit: the name ParentBroker is not the actual name
21 class MOJO_SYSTEM_IMPL_EXPORT ChildTokenSerializer : public TokenSerializer { 21 class MOJO_SYSTEM_IMPL_EXPORT ChildBroker : public Broker {
22 public: 22 public:
23 static ChildTokenSerializer* GetInstance(); 23 static ChildBroker* GetInstance();
24 24
25 // Passes the platform handle that is used to talk to ParentTokenSerializer. 25 // Passes the platform handle that is used to talk to ChildBrokerHost.
26 void SetParentTokenSerializerHandle(ScopedPlatformHandle handle); 26 void SetChildBrokerHostHandle(ScopedPlatformHandle handle);
27 27
28 // TokenSerializer implementation: 28 // Broker implementation:
29 #if defined(OS_WIN)
29 void CreatePlatformChannelPair(ScopedPlatformHandle* server, 30 void CreatePlatformChannelPair(ScopedPlatformHandle* server,
30 ScopedPlatformHandle* client) override; 31 ScopedPlatformHandle* client) override;
31 void HandleToToken(const PlatformHandle* platform_handles, 32 void HandleToToken(const PlatformHandle* platform_handles,
32 size_t count, 33 size_t count,
33 uint64_t* tokens) override; 34 uint64_t* tokens) override;
34 void TokenToHandle(const uint64_t* tokens, 35 void TokenToHandle(const uint64_t* tokens,
35 size_t count, 36 size_t count,
36 PlatformHandle* handles) override; 37 PlatformHandle* handles) override;
38 #endif
37 39
38 private: 40 private:
39 friend struct base::DefaultSingletonTraits<ChildTokenSerializer>; 41 friend struct base::DefaultSingletonTraits<ChildBroker>;
40 42
41 ChildTokenSerializer(); 43 ChildBroker();
42 ~ChildTokenSerializer() override; 44 ~ChildBroker() override;
43 45
44 // Helper method to write the given message and read back the result. 46 // Helper method to write the given message and read back the result.
45 bool WriteAndReadResponse(TokenSerializerMessage* message, 47 bool WriteAndReadResponse(BrokerMessage* message,
46 void* response, 48 void* response,
47 uint32_t response_size); 49 uint32_t response_size);
48 50
49 // Guards access to below. 51 // Guards access to below.
50 // We use LockImpl instead of Lock because the latter adds thread checking 52 // We use LockImpl instead of Lock because the latter adds thread checking
51 // that we don't want (since we lock in the constructor and unlock on another 53 // that we don't want (since we lock in the constructor and unlock on another
52 // thread. 54 // thread.
53 base::internal::LockImpl lock_; 55 base::internal::LockImpl lock_;
54 ScopedPlatformHandle handle_; 56 ScopedPlatformHandle handle_;
55 }; 57 };
56 58
57 } // namespace edk 59 } // namespace edk
58 } // namespace mojo 60 } // namespace mojo
59 61
60 #endif // MOJO_EDK_SYSTEM_CHILD_TOKEN_SERIALIZER_WIN_H_ 62 #endif // MOJO_EDK_SYSTEM_CHILD_BROKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698