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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h

Issue 2804023004: Replace ASSERT with DCHECK in modules/fetch. (Closed)
Patch Set: Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 DataConsumerHandleTestUtil_h 5 #ifndef DataConsumerHandleTestUtil_h
6 #define DataConsumerHandleTestUtil_h 6 #define DataConsumerHandleTestUtil_h
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 m_result.append(".\n"); 104 m_result.append(".\n");
105 } 105 }
106 106
107 String result() { 107 String result() {
108 MutexLocker locker(m_loggingMutex); 108 MutexLocker locker(m_loggingMutex);
109 return m_result.toString(); 109 return m_result.toString();
110 } 110 }
111 111
112 void registerThreadHolder(ThreadHolder* holder) { 112 void registerThreadHolder(ThreadHolder* holder) {
113 MutexLocker locker(m_holderMutex); 113 MutexLocker locker(m_holderMutex);
114 ASSERT(!m_holder); 114 DCHECK(!m_holder);
115 m_holder = holder; 115 m_holder = holder;
116 } 116 }
117 void unregisterThreadHolder() { 117 void unregisterThreadHolder() {
118 MutexLocker locker(m_holderMutex); 118 MutexLocker locker(m_holderMutex);
119 ASSERT(m_holder); 119 DCHECK(m_holder);
120 m_holder = nullptr; 120 m_holder = nullptr;
121 } 121 }
122 void postTaskToReadingThread(const WebTraceLocation& location, 122 void postTaskToReadingThread(const WebTraceLocation& location,
123 std::unique_ptr<CrossThreadClosure> task) { 123 std::unique_ptr<CrossThreadClosure> task) {
124 MutexLocker locker(m_holderMutex); 124 MutexLocker locker(m_holderMutex);
125 ASSERT(m_holder); 125 DCHECK(m_holder);
126 m_holder->readingThread()->postTask(location, std::move(task)); 126 m_holder->readingThread()->postTask(location, std::move(task));
127 } 127 }
128 void postTaskToUpdatingThread(const WebTraceLocation& location, 128 void postTaskToUpdatingThread(const WebTraceLocation& location,
129 std::unique_ptr<CrossThreadClosure> task) { 129 std::unique_ptr<CrossThreadClosure> task) {
130 MutexLocker locker(m_holderMutex); 130 MutexLocker locker(m_holderMutex);
131 ASSERT(m_holder); 131 DCHECK(m_holder);
132 m_holder->updatingThread()->postTask(location, std::move(task)); 132 m_holder->updatingThread()->postTask(location, std::move(task));
133 } 133 }
134 134
135 private: 135 private:
136 Context() : m_holder(nullptr) {} 136 Context() : m_holder(nullptr) {}
137 String currentThreadName() { 137 String currentThreadName() {
138 MutexLocker locker(m_holderMutex); 138 MutexLocker locker(m_holderMutex);
139 if (m_holder) { 139 if (m_holder) {
140 if (m_holder->readingThread()->isCurrentThread()) 140 if (m_holder->readingThread()->isCurrentThread())
141 return "the reading thread"; 141 return "the reading thread";
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 std::unique_ptr<T> m_handleReader; 516 std::unique_ptr<T> m_handleReader;
517 }; 517 };
518 518
519 static std::unique_ptr<WebDataConsumerHandle> 519 static std::unique_ptr<WebDataConsumerHandle>
520 createWaitingDataConsumerHandle(); 520 createWaitingDataConsumerHandle();
521 }; 521 };
522 522
523 } // namespace blink 523 } // namespace blink
524 524
525 #endif // DataConsumerHandleTestUtil_h 525 #endif // DataConsumerHandleTestUtil_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698