| 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 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // |OnReadMessage()| won't be called again. | 79 // |OnReadMessage()| won't be called again. |
| 80 virtual void OnError(Error error) = 0; | 80 virtual void OnError(Error error) = 0; |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 virtual ~Delegate() {} | 83 virtual ~Delegate() {} |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 // Static factory method. |handle| should be a handle to a | 86 // Static factory method. |handle| should be a handle to a |
| 87 // (platform-appropriate) bidirectional communication channel (e.g., a socket | 87 // (platform-appropriate) bidirectional communication channel (e.g., a socket |
| 88 // on POSIX, a named pipe on Windows). | 88 // on POSIX, a named pipe on Windows). |
| 89 static scoped_ptr<RawChannel> Create(embedder::ScopedPlatformHandle handle); | 89 static std::unique_ptr<RawChannel> Create( |
| 90 embedder::ScopedPlatformHandle handle); |
| 90 | 91 |
| 91 // This must be called (on an I/O thread) before this object is used. Does | 92 // This must be called (on an I/O thread) before this object is used. Does |
| 92 // *not* take ownership of |delegate|. Both the I/O thread and |delegate| must | 93 // *not* take ownership of |delegate|. Both the I/O thread and |delegate| must |
| 93 // remain alive until |Shutdown()| is called (unless this fails); |delegate| | 94 // remain alive until |Shutdown()| is called (unless this fails); |delegate| |
| 94 // will no longer be used after |Shutdown()|. | 95 // will no longer be used after |Shutdown()|. |
| 95 void Init(Delegate* delegate) MOJO_NOT_THREAD_SAFE; | 96 void Init(Delegate* delegate) MOJO_NOT_THREAD_SAFE; |
| 96 | 97 |
| 97 // This must be called (on the I/O thread) before this object is destroyed. | 98 // This must be called (on the I/O thread) before this object is destroyed. |
| 98 void Shutdown() MOJO_NOT_THREAD_SAFE; | 99 void Shutdown() MOJO_NOT_THREAD_SAFE; |
| 99 | 100 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 base::WeakPtrFactory<RawChannel> weak_ptr_factory_ | 330 base::WeakPtrFactory<RawChannel> weak_ptr_factory_ |
| 330 MOJO_GUARDED_BY(write_mutex_); | 331 MOJO_GUARDED_BY(write_mutex_); |
| 331 | 332 |
| 332 MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannel); | 333 MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannel); |
| 333 }; | 334 }; |
| 334 | 335 |
| 335 } // namespace system | 336 } // namespace system |
| 336 } // namespace mojo | 337 } // namespace mojo |
| 337 | 338 |
| 338 #endif // MOJO_EDK_SYSTEM_RAW_CHANNEL_H_ | 339 #endif // MOJO_EDK_SYSTEM_RAW_CHANNEL_H_ |
| OLD | NEW |