| 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_WIN_H_ | 5 #ifndef MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_ |
| 6 #define MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_ | 6 #define MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 : NON_EXPORTED_BASE(public base::MessageLoopForIO::IOHandler) { | 22 : NON_EXPORTED_BASE(public base::MessageLoopForIO::IOHandler) { |
| 23 public: | 23 public: |
| 24 // |child_process| is a handle to the child process. It's not owned by this | 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 | 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, | 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 | 27 // which is generated inside mojo::edk::ChildProcessLaunched. It is owned by |
| 28 // this class. | 28 // this class. |
| 29 ParentTokenSerializer(HANDLE child_process, ScopedPlatformHandle pipe); | 29 ParentTokenSerializer(HANDLE child_process, ScopedPlatformHandle pipe); |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 virtual ~ParentTokenSerializer() override; | 32 ~ParentTokenSerializer() override; |
| 33 | 33 |
| 34 void RegisterIOHandler(); | 34 void RegisterIOHandler(); |
| 35 void BeginRead(); | 35 void BeginRead(); |
| 36 | 36 |
| 37 void OnIOCompleted(base::MessageLoopForIO::IOContext* context, | 37 void OnIOCompleted(base::MessageLoopForIO::IOContext* context, |
| 38 DWORD bytes_transferred, | 38 DWORD bytes_transferred, |
| 39 DWORD error) override; | 39 DWORD error) override; |
| 40 | 40 |
| 41 // Helper wrappers around DuplicateHandle. | 41 // Helper wrappers around DuplicateHandle. |
| 42 HANDLE DuplicateToChild(HANDLE handle); | 42 HANDLE DuplicateToChild(HANDLE handle); |
| 43 HANDLE DuplicateFromChild(HANDLE handle); | 43 HANDLE DuplicateFromChild(HANDLE handle); |
| 44 | 44 |
| 45 HANDLE child_process_; | 45 HANDLE child_process_; |
| 46 ScopedPlatformHandle pipe_; | 46 ScopedPlatformHandle pipe_; |
| 47 base::MessageLoopForIO::IOContext read_context_; | 47 base::MessageLoopForIO::IOContext read_context_; |
| 48 base::MessageLoopForIO::IOContext write_context_; | 48 base::MessageLoopForIO::IOContext write_context_; |
| 49 | 49 |
| 50 std::vector<char> read_data_; | 50 std::vector<char> read_data_; |
| 51 // How many bytes in read_data_ we already read. | 51 // How many bytes in read_data_ we already read. |
| 52 uint32_t num_bytes_read_; | 52 uint32_t num_bytes_read_; |
| 53 std::vector<char> write_data_; | 53 std::vector<char> write_data_; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace edk | 56 } // namespace edk |
| 57 } // namespace mojo | 57 } // namespace mojo |
| 58 | 58 |
| 59 #endif // MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_ | 59 #endif // MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_ |
| OLD | NEW |