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

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: Rebase 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 DCHECK(mutex_.Locked());
144 if (!data_.IsEmpty()) { 144 if (!data_.IsEmpty()) {
145 std::pair<const uint8_t*, size_t> next_data = data_.TakeFirst(); 145 std::pair<const uint8_t*, size_t> next_data = data_.TakeFirst();
146 *data = next_data.first; 146 *data = next_data.first;
147 *length = next_data.second; 147 *length = next_data.second;
148 return true; 148 return true;
149 } 149 }
150 if (finished_) { 150 if (finished_) {
151 *length = 0; 151 *length = 0;
152 return true; 152 return true;
153 } 153 }
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // needed. This makes PendingScript notify the ScriptStreamer when it is 617 // needed. This makes PendingScript notify the ScriptStreamer when it is
618 // destroyed. 618 // destroyed.
619 script->SetStreamer(ScriptStreamer::Create(script, script_type, script_state, 619 script->SetStreamer(ScriptStreamer::Create(script, script_type, script_state,
620 compile_option, 620 compile_option,
621 std::move(loading_task_runner))); 621 std::move(loading_task_runner)));
622 622
623 return true; 623 return true;
624 } 624 }
625 625
626 } // namespace blink 626 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698