| 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 MOJO_EDK_SYSTEM_INCOMING_ENDPOINT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_INCOMING_ENDPOINT_H_ |
| 6 #define MOJO_EDK_SYSTEM_INCOMING_ENDPOINT_H_ | 6 #define MOJO_EDK_SYSTEM_INCOMING_ENDPOINT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/synchronization/lock.h" | |
| 12 #include "mojo/edk/system/channel_endpoint_client.h" | 11 #include "mojo/edk/system/channel_endpoint_client.h" |
| 13 #include "mojo/edk/system/message_in_transit_queue.h" | 12 #include "mojo/edk/system/message_in_transit_queue.h" |
| 13 #include "mojo/edk/system/mutex.h" |
| 14 #include "mojo/edk/system/system_impl_export.h" | 14 #include "mojo/edk/system/system_impl_export.h" |
| 15 #include "mojo/public/cpp/system/macros.h" | 15 #include "mojo/public/cpp/system/macros.h" |
| 16 | 16 |
| 17 struct MojoCreateDataPipeOptions; | 17 struct MojoCreateDataPipeOptions; |
| 18 | 18 |
| 19 namespace mojo { | 19 namespace mojo { |
| 20 namespace system { | 20 namespace system { |
| 21 | 21 |
| 22 class ChannelEndpoint; | 22 class ChannelEndpoint; |
| 23 class DataPipe; | 23 class DataPipe; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 // wasn't called (but |Init()| was). | 45 // wasn't called (but |Init()| was). |
| 46 void Close(); | 46 void Close(); |
| 47 | 47 |
| 48 // |ChannelEndpointClient| methods: | 48 // |ChannelEndpointClient| methods: |
| 49 bool OnReadMessage(unsigned port, MessageInTransit* message) override; | 49 bool OnReadMessage(unsigned port, MessageInTransit* message) override; |
| 50 void OnDetachFromChannel(unsigned port) override; | 50 void OnDetachFromChannel(unsigned port) override; |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 ~IncomingEndpoint() override; | 53 ~IncomingEndpoint() override; |
| 54 | 54 |
| 55 base::Lock lock_; // Protects the following members. | 55 Mutex mutex_; |
| 56 scoped_refptr<ChannelEndpoint> endpoint_; | 56 scoped_refptr<ChannelEndpoint> endpoint_ MOJO_GUARDED_BY(mutex_); |
| 57 MessageInTransitQueue message_queue_; | 57 MessageInTransitQueue message_queue_ MOJO_GUARDED_BY(mutex_); |
| 58 | 58 |
| 59 MOJO_DISALLOW_COPY_AND_ASSIGN(IncomingEndpoint); | 59 MOJO_DISALLOW_COPY_AND_ASSIGN(IncomingEndpoint); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace system | 62 } // namespace system |
| 63 } // namespace mojo | 63 } // namespace mojo |
| 64 | 64 |
| 65 #endif // MOJO_EDK_SYSTEM_INCOMING_ENDPOINT_H_ | 65 #endif // MOJO_EDK_SYSTEM_INCOMING_ENDPOINT_H_ |
| OLD | NEW |