OLD | NEW |
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_PARENT_TOKEN_SERIALIZER_STATE_WIN_H_ | 5 #ifndef MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_STATE_WIN_H_ |
6 #define MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_STATE_WIN_H_ | 6 #define MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_STATE_WIN_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 PlatformHandle* handles) override; | 36 PlatformHandle* handles) override; |
37 | 37 |
38 scoped_refptr<base::TaskRunner> token_serialize_thread() { | 38 scoped_refptr<base::TaskRunner> token_serialize_thread() { |
39 return token_serialize_thread_.task_runner(); | 39 return token_serialize_thread_.task_runner(); |
40 } | 40 } |
41 | 41 |
42 private: | 42 private: |
43 friend struct base::DefaultSingletonTraits<ParentTokenSerializerState>; | 43 friend struct base::DefaultSingletonTraits<ParentTokenSerializerState>; |
44 | 44 |
45 ParentTokenSerializerState(); | 45 ParentTokenSerializerState(); |
46 virtual ~ParentTokenSerializerState(); | 46 ~ParentTokenSerializerState() override; |
47 | 47 |
48 // A separate thread to handle sync IPCs from child processes for exchanging | 48 // A separate thread to handle sync IPCs from child processes for exchanging |
49 // platform handles with tokens. We use a separate thread because latency is | 49 // platform handles with tokens. We use a separate thread because latency is |
50 // very sensitive (since any time a pipe is created or sent, a child process | 50 // very sensitive (since any time a pipe is created or sent, a child process |
51 // makes a sync call to this class). | 51 // makes a sync call to this class). |
52 base::Thread token_serialize_thread_; | 52 base::Thread token_serialize_thread_; |
53 | 53 |
54 // Used in the parent (unsandboxed) process to hold a mapping between HANDLES | 54 // Used in the parent (unsandboxed) process to hold a mapping between HANDLES |
55 // and tokens. When a child process wants to send a HANDLE to another process, | 55 // and tokens. When a child process wants to send a HANDLE to another process, |
56 // it exchanges it to a token and then the other process exchanges that token | 56 // it exchanges it to a token and then the other process exchanges that token |
57 // back to a HANDLE. | 57 // back to a HANDLE. |
58 base::Lock lock_; // Guards access to below. | 58 base::Lock lock_; // Guards access to below. |
59 base::hash_map<uint64_t, HANDLE> token_map_; | 59 base::hash_map<uint64_t, HANDLE> token_map_; |
60 }; | 60 }; |
61 | 61 |
62 } // namespace edk | 62 } // namespace edk |
63 } // namespace mojo | 63 } // namespace mojo |
64 | 64 |
65 #endif // MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_STATE_WIN_H_ | 65 #endif // MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_STATE_WIN_H_ |
OLD | NEW |