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

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

Issue 2919413003: Fix network service hanging with empty bodies. (Closed)
Patch Set: Created 3 years, 6 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
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 content {
19 class BrowserTestBase;
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 26 matching lines...) Expand all
54 #if ENABLE_SYNC_CALL_RESTRICTIONS 58 #if ENABLE_SYNC_CALL_RESTRICTIONS
55 // Checks whether the current thread is allowed to make sync calls, and causes 59 // Checks whether the current thread is allowed to make sync calls, and causes
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:
68 // Test-only.
yzshen1 2017/06/05 21:07:04 Does it make sense to move line 68-69 into the "BE
jam 2017/06/06 00:15:47 Done.
69 friend class content::BrowserTestBase;
64 // DO NOT ADD ANY OTHER FRIEND STATEMENTS, talk to mojo/OWNERS first. 70 // DO NOT ADD ANY OTHER FRIEND STATEMENTS, talk to mojo/OWNERS first.
65 // BEGIN ALLOWED USAGE. 71 // BEGIN ALLOWED USAGE.
66 friend class ui::Gpu; // http://crbug.com/620058 72 friend class ui::Gpu; // http://crbug.com/620058
67 // LevelDBMojoProxy makes same-process sync calls from the DB thread. 73 // LevelDBMojoProxy makes same-process sync calls from the DB thread.
68 friend class leveldb::LevelDBMojoProxy; 74 friend class leveldb::LevelDBMojoProxy;
69 // Pref service connection is sync at startup. 75 // Pref service connection is sync at startup.
70 friend class prefs::PersistentPrefStoreClient; 76 friend class prefs::PersistentPrefStoreClient;
71 77
72 // END ALLOWED USAGE. 78 // END ALLOWED USAGE.
73 79
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 113
108 DISALLOW_COPY_AND_ASSIGN(ScopedAllowSyncCall); 114 DISALLOW_COPY_AND_ASSIGN(ScopedAllowSyncCall);
109 }; 115 };
110 116
111 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncCallRestrictions); 117 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncCallRestrictions);
112 }; 118 };
113 119
114 } // namespace mojo 120 } // namespace mojo
115 121
116 #endif // MOJO_PUBLIC_CPP_BINDINGS_SYNC_CALL_RESTRICTIONS_H_ 122 #endif // MOJO_PUBLIC_CPP_BINDINGS_SYNC_CALL_RESTRICTIONS_H_
OLDNEW
« no previous file with comments | « content/public/test/browser_test_base.cc ('k') | testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698