| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IPC_IPC_MESSAGE_PIPE_READER_H_ | 5 #ifndef IPC_IPC_MESSAGE_PIPE_READER_H_ |
| 6 #define IPC_IPC_MESSAGE_PIPE_READER_H_ | 6 #define IPC_IPC_MESSAGE_PIPE_READER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/atomicops.h" | 11 #include "base/atomicops.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 14 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
| 15 #include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h" | 16 #include "third_party/mojo/src/mojo/public/c/environment/async_waiter.h" |
| 16 #include "third_party/mojo/src/mojo/public/cpp/system/core.h" | 17 #include "third_party/mojo/src/mojo/public/cpp/system/core.h" |
| 17 | 18 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 42 public: | 43 public: |
| 43 virtual void OnMessageReceived(Message& message) = 0; | 44 virtual void OnMessageReceived(Message& message) = 0; |
| 44 virtual void OnPipeClosed(MessagePipeReader* reader) = 0; | 45 virtual void OnPipeClosed(MessagePipeReader* reader) = 0; |
| 45 virtual void OnPipeError(MessagePipeReader* reader) = 0; | 46 virtual void OnPipeError(MessagePipeReader* reader) = 0; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 // Delay the object deletion using the current message loop. | 49 // Delay the object deletion using the current message loop. |
| 49 // This is intended to used by MessagePipeReader owners. | 50 // This is intended to used by MessagePipeReader owners. |
| 50 class DelayedDeleter { | 51 class DelayedDeleter { |
| 51 public: | 52 public: |
| 52 typedef base::DefaultDeleter<MessagePipeReader> DefaultType; | 53 typedef std::default_delete<MessagePipeReader> DefaultType; |
| 53 | 54 |
| 54 static void DeleteNow(MessagePipeReader* ptr) { delete ptr; } | 55 static void DeleteNow(MessagePipeReader* ptr) { delete ptr; } |
| 55 | 56 |
| 56 DelayedDeleter() {} | 57 DelayedDeleter() {} |
| 57 explicit DelayedDeleter(const DefaultType&) {} | 58 explicit DelayedDeleter(const DefaultType&) {} |
| 58 DelayedDeleter& operator=(const DefaultType&) { return *this; } | 59 DelayedDeleter& operator=(const DefaultType&) { return *this; } |
| 59 | 60 |
| 60 void operator()(MessagePipeReader* ptr) const; | 61 void operator()(MessagePipeReader* ptr) const; |
| 61 }; | 62 }; |
| 62 | 63 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 base::subtle::Atomic32 pending_send_error_; | 118 base::subtle::Atomic32 pending_send_error_; |
| 118 base::ThreadChecker thread_checker_; | 119 base::ThreadChecker thread_checker_; |
| 119 | 120 |
| 120 DISALLOW_COPY_AND_ASSIGN(MessagePipeReader); | 121 DISALLOW_COPY_AND_ASSIGN(MessagePipeReader); |
| 121 }; | 122 }; |
| 122 | 123 |
| 123 } // namespace internal | 124 } // namespace internal |
| 124 } // namespace IPC | 125 } // namespace IPC |
| 125 | 126 |
| 126 #endif // IPC_IPC_MESSAGE_PIPE_READER_H_ | 127 #endif // IPC_IPC_MESSAGE_PIPE_READER_H_ |
| OLD | NEW |