| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_PUBLIC_CPP_BINDINGS_LIB_SYNC_HANDLE_REGISTRY_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_SYNC_HANDLE_REGISTRY_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_SYNC_HANDLE_REGISTRY_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_SYNC_HANDLE_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <unordered_map> | 8 #include <unordered_map> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "mojo/public/cpp/system/core.h" | 14 #include "mojo/public/cpp/system/core.h" |
| 15 | 15 |
| 16 namespace mojo { | 16 namespace mojo { |
| 17 namespace internal { | |
| 18 | 17 |
| 19 // SyncHandleRegistry is a thread-local storage to register handles that want to | 18 // SyncHandleRegistry is a thread-local storage to register handles that want to |
| 20 // be watched together. | 19 // be watched together. |
| 21 // | 20 // |
| 22 // This class is not thread safe. | 21 // This class is not thread safe. |
| 23 class SyncHandleRegistry : public base::RefCounted<SyncHandleRegistry> { | 22 class SyncHandleRegistry : public base::RefCounted<SyncHandleRegistry> { |
| 24 public: | 23 public: |
| 25 // Returns a thread-local object. | 24 // Returns a thread-local object. |
| 26 static scoped_refptr<SyncHandleRegistry> current(); | 25 static scoped_refptr<SyncHandleRegistry> current(); |
| 27 | 26 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 54 | 53 |
| 55 HandleMap handles_; | 54 HandleMap handles_; |
| 56 | 55 |
| 57 ScopedHandle wait_set_handle_; | 56 ScopedHandle wait_set_handle_; |
| 58 | 57 |
| 59 base::ThreadChecker thread_checker_; | 58 base::ThreadChecker thread_checker_; |
| 60 | 59 |
| 61 DISALLOW_COPY_AND_ASSIGN(SyncHandleRegistry); | 60 DISALLOW_COPY_AND_ASSIGN(SyncHandleRegistry); |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 } // namespace internal | |
| 65 } // namespace mojo | 63 } // namespace mojo |
| 66 | 64 |
| 67 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_SYNC_HANDLE_REGISTRY_H_ | 65 #endif // MOJO_PUBLIC_CPP_BINDINGS_SYNC_HANDLE_REGISTRY_H_ |
| OLD | NEW |