| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights |
| 5 * reserved. | 5 * reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 Task(ImageLoader* loader, | 97 Task(ImageLoader* loader, |
| 98 UpdateFromElementBehavior updateBehavior, | 98 UpdateFromElementBehavior updateBehavior, |
| 99 ReferrerPolicy referrerPolicy) | 99 ReferrerPolicy referrerPolicy) |
| 100 : m_loader(loader), | 100 : m_loader(loader), |
| 101 m_shouldBypassMainWorldCSP(shouldBypassMainWorldCSP(loader)), | 101 m_shouldBypassMainWorldCSP(shouldBypassMainWorldCSP(loader)), |
| 102 m_updateBehavior(updateBehavior), | 102 m_updateBehavior(updateBehavior), |
| 103 m_weakFactory(this), | 103 m_weakFactory(this), |
| 104 m_referrerPolicy(referrerPolicy) { | 104 m_referrerPolicy(referrerPolicy) { |
| 105 ExecutionContext& context = m_loader->element()->document(); | 105 ExecutionContext& context = m_loader->element()->document(); |
| 106 InspectorInstrumentation::asyncTaskScheduled(&context, "Image", this); | 106 probe::asyncTaskScheduled(&context, "Image", this); |
| 107 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); | 107 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); |
| 108 v8::HandleScope scope(isolate); | 108 v8::HandleScope scope(isolate); |
| 109 // If we're invoked from C++ without a V8 context on the stack, we should | 109 // If we're invoked from C++ without a V8 context on the stack, we should |
| 110 // run the microtask in the context of the element's document's main world. | 110 // run the microtask in the context of the element's document's main world. |
| 111 if (!isolate->GetCurrentContext().IsEmpty()) { | 111 if (!isolate->GetCurrentContext().IsEmpty()) { |
| 112 m_scriptState = ScriptState::current(isolate); | 112 m_scriptState = ScriptState::current(isolate); |
| 113 } else { | 113 } else { |
| 114 m_scriptState = | 114 m_scriptState = |
| 115 ScriptState::forMainWorld(loader->element()->document().frame()); | 115 ScriptState::forMainWorld(loader->element()->document().frame()); |
| 116 DCHECK(m_scriptState); | 116 DCHECK(m_scriptState); |
| 117 } | 117 } |
| 118 m_requestURL = | 118 m_requestURL = |
| 119 loader->imageSourceToKURL(loader->element()->imageSourceURL()); | 119 loader->imageSourceToKURL(loader->element()->imageSourceURL()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void run() { | 122 void run() { |
| 123 if (!m_loader) | 123 if (!m_loader) |
| 124 return; | 124 return; |
| 125 ExecutionContext& context = m_loader->element()->document(); | 125 ExecutionContext& context = m_loader->element()->document(); |
| 126 InspectorInstrumentation::AsyncTask asyncTask(&context, this); | 126 probe::AsyncTask asyncTask(&context, this); |
| 127 if (m_scriptState->contextIsValid()) { | 127 if (m_scriptState->contextIsValid()) { |
| 128 ScriptState::Scope scope(m_scriptState.get()); | 128 ScriptState::Scope scope(m_scriptState.get()); |
| 129 m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, | 129 m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, |
| 130 m_updateBehavior, m_requestURL, | 130 m_updateBehavior, m_requestURL, |
| 131 m_referrerPolicy); | 131 m_referrerPolicy); |
| 132 } else { | 132 } else { |
| 133 m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, | 133 m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, |
| 134 m_updateBehavior, m_requestURL, | 134 m_updateBehavior, m_requestURL, |
| 135 m_referrerPolicy); | 135 m_referrerPolicy); |
| 136 } | 136 } |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 } | 634 } |
| 635 | 635 |
| 636 void ImageLoader::elementDidMoveToNewDocument() { | 636 void ImageLoader::elementDidMoveToNewDocument() { |
| 637 if (m_loadDelayCounter) | 637 if (m_loadDelayCounter) |
| 638 m_loadDelayCounter->documentChanged(m_element->document()); | 638 m_loadDelayCounter->documentChanged(m_element->document()); |
| 639 clearFailedLoadURL(); | 639 clearFailedLoadURL(); |
| 640 setImage(0); | 640 setImage(0); |
| 641 } | 641 } |
| 642 | 642 |
| 643 } // namespace blink | 643 } // namespace blink |
| OLD | NEW |