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

Side by Side Diff: mojo/edk/system/parent_token_serializer_win.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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_
6 #define MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_
7
8 #include <vector>
9
10 #include "base/compiler_specific.h"
11 #include "base/message_loop/message_loop.h"
12 #include "mojo/edk/embedder/scoped_platform_handle.h"
13 #include "mojo/edk/system/system_impl_export.h"
14
15 namespace mojo {
16 namespace edk {
17
18 // Responds to requests from a child process to exchange handles to tokens and
19 // vice versa. There is one object of this class per child process host object.
20 // This object will delete itself when it notices that the pipe is broken.
21 class MOJO_SYSTEM_IMPL_EXPORT ParentTokenSerializer
22 : NON_EXPORTED_BASE(public base::MessageLoopForIO::IOHandler) {
23 public:
24 // |child_process| is a handle to the child process. It's not owned by this
25 // class but is guaranteed to be alive as long as the child process is
26 // running. |pipe| is a handle to the communication pipe to the child process,
27 // which is generated inside mojo::edk::ChildProcessLaunched. It is owned by
28 // this class.
29 ParentTokenSerializer(HANDLE child_process, ScopedPlatformHandle pipe);
30
31 private:
32 ~ParentTokenSerializer() override;
33
34 void RegisterIOHandler();
35 void BeginRead();
36
37 void OnIOCompleted(base::MessageLoopForIO::IOContext* context,
38 DWORD bytes_transferred,
39 DWORD error) override;
40
41 // Helper wrappers around DuplicateHandle.
42 HANDLE DuplicateToChild(HANDLE handle);
43 HANDLE DuplicateFromChild(HANDLE handle);
44
45 HANDLE child_process_;
46 ScopedPlatformHandle pipe_;
47 base::MessageLoopForIO::IOContext read_context_;
48 base::MessageLoopForIO::IOContext write_context_;
49
50 std::vector<char> read_data_;
51 // How many bytes in read_data_ we already read.
52 uint32_t num_bytes_read_;
53 std::vector<char> write_data_;
54 };
55
56 } // namespace edk
57 } // namespace mojo
58
59 #endif // MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698