Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 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(!prefinalizer_called_); |
| 45 CHECK(GetElement()); | 45 CHECK(GetElement()); |
| 46 CHECK(GetResource() || !streamer_); | 46 CHECK(GetResource() || !streamer_); |
| 47 CHECK(!streamer_ || streamer_->GetResource() == GetResource()); | 47 CHECK(!streamer_ || streamer_->GetResource() == GetResource()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 NOINLINE void ClassicPendingScript::Dispose() { | 50 void ClassicPendingScript::Prefinalize() { |
| 51 PendingScript::Dispose(); | 51 // TODO(hiroshige): Consider moving this to ScriptStreamer's prefinalizer. |
|
kouhei (in TOK)
2017/04/26 00:22:52
Maybe dtor is enough.
haraken
2017/04/26 01:06:23
Agreed.
| |
| 52 // https://crbug.com/715309 | |
| 53 if (streamer_) | |
| 54 streamer_->Cancel(); | |
| 52 prefinalizer_called_ = true; | 55 prefinalizer_called_ = true; |
| 53 } | 56 } |
| 54 | 57 |
| 55 void ClassicPendingScript::DisposeInternal() { | 58 void ClassicPendingScript::DisposeInternal() { |
| 56 MemoryCoordinator::Instance().UnregisterClient(this); | 59 MemoryCoordinator::Instance().UnregisterClient(this); |
| 57 SetResource(nullptr); | 60 SetResource(nullptr); |
| 58 integrity_failure_ = false; | 61 integrity_failure_ = false; |
| 59 if (streamer_) | 62 if (streamer_) |
| 60 streamer_->Cancel(); | 63 streamer_->Cancel(); |
| 61 streamer_ = nullptr; | 64 streamer_ = nullptr; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 | 233 |
| 231 KURL ClassicPendingScript::UrlForClassicScript() const { | 234 KURL ClassicPendingScript::UrlForClassicScript() const { |
| 232 return GetResource()->Url(); | 235 return GetResource()->Url(); |
| 233 } | 236 } |
| 234 | 237 |
| 235 void ClassicPendingScript::RemoveFromMemoryCache() { | 238 void ClassicPendingScript::RemoveFromMemoryCache() { |
| 236 GetMemoryCache()->Remove(GetResource()); | 239 GetMemoryCache()->Remove(GetResource()); |
| 237 } | 240 } |
| 238 | 241 |
| 239 } // namespace blink | 242 } // namespace blink |
| OLD | NEW |