| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RAW_CHANNEL_H_ | 5 #ifndef MOJO_EDK_SYSTEM_RAW_CHANNEL_H_ |
| 6 #define MOJO_EDK_SYSTEM_RAW_CHANNEL_H_ | 6 #define MOJO_EDK_SYSTEM_RAW_CHANNEL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "mojo/edk/platform/platform_handle.h" | 11 #include "mojo/edk/platform/platform_handle.h" |
| 13 #include "mojo/edk/platform/platform_handle_watcher.h" | 12 #include "mojo/edk/platform/platform_handle_watcher.h" |
| 14 #include "mojo/edk/platform/scoped_platform_handle.h" | 13 #include "mojo/edk/platform/scoped_platform_handle.h" |
| 15 #include "mojo/edk/platform/task_runner.h" | 14 #include "mojo/edk/platform/task_runner.h" |
| 16 #include "mojo/edk/system/message_in_transit.h" | 15 #include "mojo/edk/system/message_in_transit.h" |
| 17 #include "mojo/edk/system/message_in_transit_queue.h" | 16 #include "mojo/edk/system/message_in_transit_queue.h" |
| 18 #include "mojo/edk/util/mutex.h" | 17 #include "mojo/edk/util/mutex.h" |
| 19 #include "mojo/edk/util/ref_ptr.h" | 18 #include "mojo/edk/util/ref_ptr.h" |
| 20 #include "mojo/edk/util/thread_annotations.h" | 19 #include "mojo/edk/util/thread_annotations.h" |
| 20 #include "mojo/edk/util/weak_ptr.h" |
| 21 #include "mojo/public/cpp/system/macros.h" | 21 #include "mojo/public/cpp/system/macros.h" |
| 22 | 22 |
| 23 namespace mojo { | 23 namespace mojo { |
| 24 namespace system { | 24 namespace system { |
| 25 | 25 |
| 26 // |RawChannel| is an interface and base class for objects that wrap an OS | 26 // |RawChannel| is an interface and base class for objects that wrap an OS |
| 27 // "pipe". It presents the following interface to users: | 27 // "pipe". It presents the following interface to users: |
| 28 // - Receives and dispatches messages on an I/O thread (running a | 28 // - Receives and dispatches messages on an I/O thread (running a |
| 29 // |MessageLoopForIO|. | 29 // |MessageLoopForIO|. |
| 30 // - Provides a thread-safe way of writing messages (|WriteMessage()|); | 30 // - Provides a thread-safe way of writing messages (|WriteMessage()|); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 Delegate* delegate_; | 327 Delegate* delegate_; |
| 328 bool* set_on_shutdown_; | 328 bool* set_on_shutdown_; |
| 329 std::unique_ptr<ReadBuffer> read_buffer_; | 329 std::unique_ptr<ReadBuffer> read_buffer_; |
| 330 | 330 |
| 331 util::Mutex write_mutex_; // Protects the following members. | 331 util::Mutex write_mutex_; // Protects the following members. |
| 332 bool write_stopped_ MOJO_GUARDED_BY(write_mutex_); | 332 bool write_stopped_ MOJO_GUARDED_BY(write_mutex_); |
| 333 std::unique_ptr<WriteBuffer> write_buffer_ MOJO_GUARDED_BY(write_mutex_); | 333 std::unique_ptr<WriteBuffer> write_buffer_ MOJO_GUARDED_BY(write_mutex_); |
| 334 | 334 |
| 335 // This is used for posting tasks from write threads to the I/O thread. The | 335 // This is used for posting tasks from write threads to the I/O thread. The |
| 336 // weak pointers it produces are only used/invalidated on the I/O thread. | 336 // weak pointers it produces are only used/invalidated on the I/O thread. |
| 337 base::WeakPtrFactory<RawChannel> weak_ptr_factory_ | 337 util::WeakPtrFactory<RawChannel> weak_ptr_factory_ |
| 338 MOJO_GUARDED_BY(write_mutex_); | 338 MOJO_GUARDED_BY(write_mutex_); |
| 339 | 339 |
| 340 MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannel); | 340 MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannel); |
| 341 }; | 341 }; |
| 342 | 342 |
| 343 } // namespace system | 343 } // namespace system |
| 344 } // namespace mojo | 344 } // namespace mojo |
| 345 | 345 |
| 346 #endif // MOJO_EDK_SYSTEM_RAW_CHANNEL_H_ | 346 #endif // MOJO_EDK_SYSTEM_RAW_CHANNEL_H_ |
| OLD | NEW |