| 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_SYNC_CALL_RESTRICTIONS_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_SYNC_CALL_RESTRICTIONS_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_SYNC_CALL_RESTRICTIONS_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_SYNC_CALL_RESTRICTIONS_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "mojo/public/cpp/bindings/bindings_export.h" | 10 #include "mojo/public/cpp/bindings/bindings_export.h" |
| 11 | 11 |
| 12 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) | 12 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) |
| 13 #define ENABLE_SYNC_CALL_RESTRICTIONS 1 | 13 #define ENABLE_SYNC_CALL_RESTRICTIONS 1 |
| 14 #else | 14 #else |
| 15 #define ENABLE_SYNC_CALL_RESTRICTIONS 0 | 15 #define ENABLE_SYNC_CALL_RESTRICTIONS 0 |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace aura { |
| 19 class WindowTreeClient; |
| 20 } |
| 21 |
| 18 namespace display { | 22 namespace display { |
| 19 class ForwardingDisplayDelegate; | 23 class ForwardingDisplayDelegate; |
| 20 } | 24 } |
| 21 | 25 |
| 22 namespace leveldb { | 26 namespace leveldb { |
| 23 class LevelDBMojoProxy; | 27 class LevelDBMojoProxy; |
| 24 } | 28 } |
| 25 | 29 |
| 26 namespace prefs { | 30 namespace prefs { |
| 27 class PersistentPrefStoreClient; | 31 class PersistentPrefStoreClient; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 56 // a DCHECK if not. | 60 // a DCHECK if not. |
| 57 static void AssertSyncCallAllowed(); | 61 static void AssertSyncCallAllowed(); |
| 58 #else | 62 #else |
| 59 // Inline the empty definitions of functions so that they can be compiled out. | 63 // Inline the empty definitions of functions so that they can be compiled out. |
| 60 static void AssertSyncCallAllowed() {} | 64 static void AssertSyncCallAllowed() {} |
| 61 #endif | 65 #endif |
| 62 | 66 |
| 63 private: | 67 private: |
| 64 // DO NOT ADD ANY OTHER FRIEND STATEMENTS, talk to mojo/OWNERS first. | 68 // DO NOT ADD ANY OTHER FRIEND STATEMENTS, talk to mojo/OWNERS first. |
| 65 // BEGIN ALLOWED USAGE. | 69 // BEGIN ALLOWED USAGE. |
| 70 friend class aura::WindowTreeClient; // http://ctbug.com/712302 |
| 66 friend class ui::Gpu; // http://crbug.com/620058 | 71 friend class ui::Gpu; // http://crbug.com/620058 |
| 67 // LevelDBMojoProxy makes same-process sync calls from the DB thread. | 72 // LevelDBMojoProxy makes same-process sync calls from the DB thread. |
| 68 friend class leveldb::LevelDBMojoProxy; | 73 friend class leveldb::LevelDBMojoProxy; |
| 69 // Pref service connection is sync at startup. | 74 // Pref service connection is sync at startup. |
| 70 friend class prefs::PersistentPrefStoreClient; | 75 friend class prefs::PersistentPrefStoreClient; |
| 71 | 76 |
| 72 // END ALLOWED USAGE. | 77 // END ALLOWED USAGE. |
| 73 | 78 |
| 74 // BEGIN USAGE THAT NEEDS TO BE FIXED. | 79 // BEGIN USAGE THAT NEEDS TO BE FIXED. |
| 75 // In the non-mus case, we called blocking OS functions in the ui::Clipboard | 80 // In the non-mus case, we called blocking OS functions in the ui::Clipboard |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 112 |
| 108 DISALLOW_COPY_AND_ASSIGN(ScopedAllowSyncCall); | 113 DISALLOW_COPY_AND_ASSIGN(ScopedAllowSyncCall); |
| 109 }; | 114 }; |
| 110 | 115 |
| 111 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncCallRestrictions); | 116 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncCallRestrictions); |
| 112 }; | 117 }; |
| 113 | 118 |
| 114 } // namespace mojo | 119 } // namespace mojo |
| 115 | 120 |
| 116 #endif // MOJO_PUBLIC_CPP_BINDINGS_SYNC_CALL_RESTRICTIONS_H_ | 121 #endif // MOJO_PUBLIC_CPP_BINDINGS_SYNC_CALL_RESTRICTIONS_H_ |
| OLD | NEW |