| 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_SYSTEM_RAW_CHANNEL_H_ | 5 #ifndef MOJO_SYSTEM_RAW_CHANNEL_H_ |
| 6 #define MOJO_SYSTEM_RAW_CHANNEL_H_ | 6 #define MOJO_SYSTEM_RAW_CHANNEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "mojo/public/system/system_export.h" | |
| 12 #include "mojo/system/limits.h" | 11 #include "mojo/system/limits.h" |
| 12 #include "mojo/system/system_impl_export.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class MessageLoop; | 15 class MessageLoop; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace mojo { | 18 namespace mojo { |
| 19 namespace system { | 19 namespace system { |
| 20 | 20 |
| 21 class MessageInTransit; | 21 class MessageInTransit; |
| 22 | 22 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 // - Provides a thread-safe way of writing messages (|WriteMessage()|); | 33 // - Provides a thread-safe way of writing messages (|WriteMessage()|); |
| 34 // writing/queueing messages will not block and is atomic from the point of | 34 // writing/queueing messages will not block and is atomic from the point of |
| 35 // view of the caller. If necessary, messages are queued (to be written on | 35 // view of the caller. If necessary, messages are queued (to be written on |
| 36 // the aforementioned thread). | 36 // the aforementioned thread). |
| 37 // | 37 // |
| 38 // OS-specific implementation subclasses are to be instantiated using the | 38 // OS-specific implementation subclasses are to be instantiated using the |
| 39 // |Create()| static factory method. | 39 // |Create()| static factory method. |
| 40 // | 40 // |
| 41 // With the exception of |WriteMessage()|, this class is thread-unsafe (and in | 41 // With the exception of |WriteMessage()|, this class is thread-unsafe (and in |
| 42 // general its methods should only be used on the I/O thread). | 42 // general its methods should only be used on the I/O thread). |
| 43 class MOJO_SYSTEM_EXPORT RawChannel { | 43 class MOJO_SYSTEM_IMPL_EXPORT RawChannel { |
| 44 public: | 44 public: |
| 45 virtual ~RawChannel() {} | 45 virtual ~RawChannel() {} |
| 46 | 46 |
| 47 // The |Delegate| is only accessed on the same thread as the message loop | 47 // The |Delegate| is only accessed on the same thread as the message loop |
| 48 // (passed in on creation). | 48 // (passed in on creation). |
| 49 class MOJO_SYSTEM_EXPORT Delegate { | 49 class MOJO_SYSTEM_IMPL_EXPORT Delegate { |
| 50 public: | 50 public: |
| 51 enum FatalError { | 51 enum FatalError { |
| 52 FATAL_ERROR_UNKNOWN = 0, | 52 FATAL_ERROR_UNKNOWN = 0, |
| 53 FATAL_ERROR_FAILED_READ, | 53 FATAL_ERROR_FAILED_READ, |
| 54 FATAL_ERROR_FAILED_WRITE | 54 FATAL_ERROR_FAILED_WRITE |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // Called when a message is read. This may call |Shutdown()| on the | 57 // Called when a message is read. This may call |Shutdown()| on the |
| 58 // |RawChannel|, but must not destroy it. | 58 // |RawChannel|, but must not destroy it. |
| 59 virtual void OnReadMessage(const MessageInTransit& message) = 0; | 59 virtual void OnReadMessage(const MessageInTransit& message) = 0; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 Delegate* const delegate_; | 95 Delegate* const delegate_; |
| 96 base::MessageLoop* const message_loop_; | 96 base::MessageLoop* const message_loop_; |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(RawChannel); | 98 DISALLOW_COPY_AND_ASSIGN(RawChannel); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace system | 101 } // namespace system |
| 102 } // namespace mojo | 102 } // namespace mojo |
| 103 | 103 |
| 104 #endif // MOJO_SYSTEM_RAW_CHANNEL_H_ | 104 #endif // MOJO_SYSTEM_RAW_CHANNEL_H_ |
| OLD | NEW |