| 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_DATA_PIPE_CONSUMER_DISPATCHER_H_ | 5 #ifndef MOJO_SYSTEM_DATA_PIPE_CONSUMER_DISPATCHER_H_ |
| 6 #define MOJO_SYSTEM_DATA_PIPE_CONSUMER_DISPATCHER_H_ | 6 #define MOJO_SYSTEM_DATA_PIPE_CONSUMER_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "mojo/system/dispatcher.h" | 11 #include "mojo/system/dispatcher.h" |
| 12 #include "mojo/system/system_impl_export.h" | 12 #include "mojo/system/system_impl_export.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 namespace system { | 15 namespace system { |
| 16 | 16 |
| 17 class DataPipe; | 17 class DataPipe; |
| 18 | 18 |
| 19 // This is the |Dispatcher| implementation for the consumer handle for data | 19 // This is the |Dispatcher| implementation for the consumer handle for data |
| 20 // pipes (created by the Mojo primitive |MojoCreateDataPipe()|). This class is | 20 // pipes (created by the Mojo primitive |MojoCreateDataPipe()|). This class is |
| 21 // thread-safe. | 21 // thread-safe. |
| 22 class MOJO_SYSTEM_IMPL_EXPORT DataPipeConsumerDispatcher : public Dispatcher { | 22 class MOJO_SYSTEM_IMPL_EXPORT DataPipeConsumerDispatcher : public Dispatcher { |
| 23 public: | 23 public: |
| 24 DataPipeConsumerDispatcher(); | 24 DataPipeConsumerDispatcher(); |
| 25 | 25 |
| 26 // Must be called before any other methods. | 26 // Must be called before any other methods. |
| 27 void Init(scoped_refptr<DataPipe> data_pipe); | 27 void Init(scoped_refptr<DataPipe> data_pipe); |
| 28 | 28 |
| 29 virtual Type GetType() OVERRIDE; |
| 30 |
| 29 private: | 31 private: |
| 30 friend class base::RefCountedThreadSafe<DataPipeConsumerDispatcher>; | 32 friend class base::RefCountedThreadSafe<DataPipeConsumerDispatcher>; |
| 31 virtual ~DataPipeConsumerDispatcher(); | 33 virtual ~DataPipeConsumerDispatcher(); |
| 32 | 34 |
| 33 // |Dispatcher| implementation/overrides: | 35 // |Dispatcher| implementation/overrides: |
| 34 virtual void CancelAllWaitersNoLock() OVERRIDE; | 36 virtual void CancelAllWaitersNoLock() OVERRIDE; |
| 35 virtual MojoResult CloseImplNoLock() OVERRIDE; | 37 virtual MojoResult CloseImplNoLock() OVERRIDE; |
| 36 virtual MojoResult ReadDataImplNoLock(void* elements, | 38 virtual MojoResult ReadDataImplNoLock(void* elements, |
| 37 uint32_t* num_bytes, | 39 uint32_t* num_bytes, |
| 38 MojoReadDataFlags flags) OVERRIDE; | 40 MojoReadDataFlags flags) OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 51 // Protected by |lock()|: | 53 // Protected by |lock()|: |
| 52 scoped_refptr<DataPipe> data_pipe_; // This will be null if closed. | 54 scoped_refptr<DataPipe> data_pipe_; // This will be null if closed. |
| 53 | 55 |
| 54 DISALLOW_COPY_AND_ASSIGN(DataPipeConsumerDispatcher); | 56 DISALLOW_COPY_AND_ASSIGN(DataPipeConsumerDispatcher); |
| 55 }; | 57 }; |
| 56 | 58 |
| 57 } // namespace system | 59 } // namespace system |
| 58 } // namespace mojo | 60 } // namespace mojo |
| 59 | 61 |
| 60 #endif // MOJO_SYSTEM_DATA_PIPE_CONSUMER_DISPATCHER_H_ | 62 #endif // MOJO_SYSTEM_DATA_PIPE_CONSUMER_DISPATCHER_H_ |
| OLD | NEW |