OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 #include "FetchManager.h" | 6 #include "FetchManager.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 322 |
323 void FetchManager::Loader::failed() | 323 void FetchManager::Loader::failed() |
324 { | 324 { |
325 if (m_failed) | 325 if (m_failed) |
326 return; | 326 return; |
327 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) | 327 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
328 return; | 328 return; |
329 m_failed = true; | 329 m_failed = true; |
330 ScriptState* state = m_resolver->scriptState(); | 330 ScriptState* state = m_resolver->scriptState(); |
331 ScriptState::Scope scope(state); | 331 ScriptState::Scope scope(state); |
332 m_resolver->reject(V8ThrowException::createTypeError("Failed to fetch", stat
e->isolate())); | 332 m_resolver->reject(V8ThrowException::createTypeError(state->isolate(), "Fail
ed to fetch")); |
333 notifyFinished(); | 333 notifyFinished(); |
334 } | 334 } |
335 | 335 |
336 void FetchManager::Loader::notifyFinished() | 336 void FetchManager::Loader::notifyFinished() |
337 { | 337 { |
338 if (m_fetchManager) | 338 if (m_fetchManager) |
339 m_fetchManager->onLoaderFinished(this); | 339 m_fetchManager->onLoaderFinished(this); |
340 } | 340 } |
341 | 341 |
342 FetchManager::FetchManager(ExecutionContext* executionContext) | 342 FetchManager::FetchManager(ExecutionContext* executionContext) |
(...skipping 18 matching lines...) Expand all Loading... |
361 loader->start(); | 361 loader->start(); |
362 return promise; | 362 return promise; |
363 } | 363 } |
364 | 364 |
365 void FetchManager::onLoaderFinished(Loader* loader) | 365 void FetchManager::onLoaderFinished(Loader* loader) |
366 { | 366 { |
367 m_loaders.remove(loader); | 367 m_loaders.remove(loader); |
368 } | 368 } |
369 | 369 |
370 } // namespace blink | 370 } // namespace blink |
OLD | NEW |