Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: mojo/public/cpp/bindings/sync_call_restrictions.h

Issue 2835933005: Make ForwardingDisplayDelegate initially sync. (Closed)
Patch Set: Add comment explaining sync usage. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | services/ui/display/screen_manager_forwarding.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 display {
19 class ForwardingDisplayDelegate;
20 }
21
18 namespace leveldb { 22 namespace leveldb {
19 class LevelDBMojoProxy; 23 class LevelDBMojoProxy;
20 } 24 }
21 25
22 namespace prefs { 26 namespace prefs {
23 class PersistentPrefStoreClient; 27 class PersistentPrefStoreClient;
24 } 28 }
25 29
26 namespace ui { 30 namespace ui {
27 class Gpu; 31 class Gpu;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Pref service connection is sync at startup. 69 // Pref service connection is sync at startup.
66 friend class prefs::PersistentPrefStoreClient; 70 friend class prefs::PersistentPrefStoreClient;
67 71
68 // END ALLOWED USAGE. 72 // END ALLOWED USAGE.
69 73
70 // BEGIN USAGE THAT NEEDS TO BE FIXED. 74 // BEGIN USAGE THAT NEEDS TO BE FIXED.
71 // In the non-mus case, we called blocking OS functions in the ui::Clipboard 75 // In the non-mus case, we called blocking OS functions in the ui::Clipboard
72 // implementation which weren't caught by sync call restrictions. Our blocking 76 // implementation which weren't caught by sync call restrictions. Our blocking
73 // calls to mus, however, are. 77 // calls to mus, however, are.
74 friend class views::ClipboardMus; 78 friend class views::ClipboardMus;
79 // In ash::Shell::Init() it assumes that NativeDisplayDelegate will be
80 // synchronous at first. In mushrome ForwardingDisplayDelegate uses a
81 // synchronous call to get the display snapshots as a workaround.
82 friend class display::ForwardingDisplayDelegate;
75 // END USAGE THAT NEEDS TO BE FIXED. 83 // END USAGE THAT NEEDS TO BE FIXED.
76 84
77 #if ENABLE_SYNC_CALL_RESTRICTIONS 85 #if ENABLE_SYNC_CALL_RESTRICTIONS
78 static void IncreaseScopedAllowCount(); 86 static void IncreaseScopedAllowCount();
79 static void DecreaseScopedAllowCount(); 87 static void DecreaseScopedAllowCount();
80 #else 88 #else
81 static void IncreaseScopedAllowCount() {} 89 static void IncreaseScopedAllowCount() {}
82 static void DecreaseScopedAllowCount() {} 90 static void DecreaseScopedAllowCount() {}
83 #endif 91 #endif
84 92
(...skipping 14 matching lines...) Expand all
99 107
100 DISALLOW_COPY_AND_ASSIGN(ScopedAllowSyncCall); 108 DISALLOW_COPY_AND_ASSIGN(ScopedAllowSyncCall);
101 }; 109 };
102 110
103 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncCallRestrictions); 111 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncCallRestrictions);
104 }; 112 };
105 113
106 } // namespace mojo 114 } // namespace mojo
107 115
108 #endif // MOJO_PUBLIC_CPP_BINDINGS_SYNC_CALL_RESTRICTIONS_H_ 116 #endif // MOJO_PUBLIC_CPP_BINDINGS_SYNC_CALL_RESTRICTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/display/screen_manager_forwarding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698