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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp

Issue 2817533003: Replace ASSERT, RELEASE_ASSERT, and ASSERT_NOT_REACHED in bindings (Closed)
Patch Set: fixed dcheck build error 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "bindings/core/v8/ScriptStreamer.h" 5 #include "bindings/core/v8/ScriptStreamer.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/ScriptStreamerThread.h" 8 #include "bindings/core/v8/ScriptStreamerThread.h"
9 #include "bindings/core/v8/V8ScriptRunner.h" 9 #include "bindings/core/v8/V8ScriptRunner.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 133 }
134 134
135 void Consume(const uint8_t** data, size_t* length) { 135 void Consume(const uint8_t** data, size_t* length) {
136 MutexLocker locker(mutex_); 136 MutexLocker locker(mutex_);
137 while (!TryGetData(data, length)) 137 while (!TryGetData(data, length))
138 have_data_.Wait(mutex_); 138 have_data_.Wait(mutex_);
139 } 139 }
140 140
141 private: 141 private:
142 bool TryGetData(const uint8_t** data, size_t* length) { 142 bool TryGetData(const uint8_t** data, size_t* length) {
143 ASSERT(mutex_.Locked()); 143 #if DCHECK_IS_ON()
144 DCHECK(mutex_.Locked());
145 #endif
144 if (!data_.IsEmpty()) { 146 if (!data_.IsEmpty()) {
145 std::pair<const uint8_t*, size_t> next_data = data_.TakeFirst(); 147 std::pair<const uint8_t*, size_t> next_data = data_.TakeFirst();
146 *data = next_data.first; 148 *data = next_data.first;
147 *length = next_data.second; 149 *length = next_data.second;
148 return true; 150 return true;
149 } 151 }
150 if (finished_) { 152 if (finished_) {
151 *length = 0; 153 *length = 0;
152 return true; 154 return true;
153 } 155 }
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // needed. This makes PendingScript notify the ScriptStreamer when it is 619 // needed. This makes PendingScript notify the ScriptStreamer when it is
618 // destroyed. 620 // destroyed.
619 script->SetStreamer(ScriptStreamer::Create(script, script_type, script_state, 621 script->SetStreamer(ScriptStreamer::Create(script, script_type, script_state,
620 compile_option, 622 compile_option,
621 std::move(loading_task_runner))); 623 std::move(loading_task_runner)));
622 624
623 return true; 625 return true;
624 } 626 }
625 627
626 } // namespace blink 628 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698