| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "core/dom/ClassicPendingScript.h" | 5 #include "core/dom/ClassicPendingScript.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptSourceCode.h" | 7 #include "bindings/core/v8/ScriptSourceCode.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/ScriptStreamer.h" | 9 #include "bindings/core/v8/ScriptStreamer.h" |
| 10 #include "bindings/core/v8/V8BindingForCore.h" | 10 #include "bindings/core/v8/V8BindingForCore.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 : PendingScript(element, starting_position), integrity_failure_(false) { | 34 : PendingScript(element, starting_position), integrity_failure_(false) { |
| 35 CheckState(); | 35 CheckState(); |
| 36 SetResource(resource); | 36 SetResource(resource); |
| 37 MemoryCoordinator::Instance().RegisterClient(this); | 37 MemoryCoordinator::Instance().RegisterClient(this); |
| 38 } | 38 } |
| 39 | 39 |
| 40 ClassicPendingScript::~ClassicPendingScript() {} | 40 ClassicPendingScript::~ClassicPendingScript() {} |
| 41 | 41 |
| 42 NOINLINE void ClassicPendingScript::CheckState() const { | 42 NOINLINE void ClassicPendingScript::CheckState() const { |
| 43 // TODO(hiroshige): Turn these CHECK()s into DCHECK() before going to beta. | 43 // TODO(hiroshige): Turn these CHECK()s into DCHECK() before going to beta. |
| 44 CHECK(!prefinalizer_called_); |
| 44 CHECK(GetElement()); | 45 CHECK(GetElement()); |
| 45 CHECK(GetResource() || !streamer_); | 46 CHECK(GetResource() || !streamer_); |
| 46 CHECK(!streamer_ || streamer_->GetResource() == GetResource()); | 47 CHECK(!streamer_ || streamer_->GetResource() == GetResource()); |
| 47 } | 48 } |
| 48 | 49 |
| 49 NOINLINE void ClassicPendingScript::Dispose() { | 50 NOINLINE void ClassicPendingScript::Dispose() { |
| 50 PendingScript::Dispose(); | 51 PendingScript::Dispose(); |
| 52 prefinalizer_called_ = true; |
| 51 } | 53 } |
| 52 | 54 |
| 53 void ClassicPendingScript::DisposeInternal() { | 55 void ClassicPendingScript::DisposeInternal() { |
| 54 MemoryCoordinator::Instance().UnregisterClient(this); | 56 MemoryCoordinator::Instance().UnregisterClient(this); |
| 55 SetResource(nullptr); | 57 SetResource(nullptr); |
| 56 integrity_failure_ = false; | 58 integrity_failure_ = false; |
| 57 if (streamer_) | 59 if (streamer_) |
| 58 streamer_->Cancel(); | 60 streamer_->Cancel(); |
| 59 streamer_ = nullptr; | 61 streamer_ = nullptr; |
| 60 } | 62 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 230 |
| 229 KURL ClassicPendingScript::UrlForClassicScript() const { | 231 KURL ClassicPendingScript::UrlForClassicScript() const { |
| 230 return GetResource()->Url(); | 232 return GetResource()->Url(); |
| 231 } | 233 } |
| 232 | 234 |
| 233 void ClassicPendingScript::RemoveFromMemoryCache() { | 235 void ClassicPendingScript::RemoveFromMemoryCache() { |
| 234 GetMemoryCache()->Remove(GetResource()); | 236 GetMemoryCache()->Remove(GetResource()); |
| 235 } | 237 } |
| 236 | 238 |
| 237 } // namespace blink | 239 } // namespace blink |
| OLD | NEW |