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 "modules/fetch/Response.h" | 5 #include "modules/fetch/Response.h" |
6 | 6 |
7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "bindings/core/v8/V8ArrayBuffer.h" | 10 #include "bindings/core/v8/V8ArrayBuffer.h" |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 } | 438 } |
439 | 439 |
440 String Response::mimeType() const { | 440 String Response::mimeType() const { |
441 return m_response->mimeType(); | 441 return m_response->mimeType(); |
442 } | 442 } |
443 | 443 |
444 String Response::internalMIMEType() const { | 444 String Response::internalMIMEType() const { |
445 return m_response->internalMIMEType(); | 445 return m_response->internalMIMEType(); |
446 } | 446 } |
447 | 447 |
| 448 const Vector<KURL>& Response::internalURLList() const { |
| 449 return m_response->internalURLList(); |
| 450 } |
| 451 |
448 void Response::installBody() { | 452 void Response::installBody() { |
449 if (!internalBodyBuffer()) | 453 if (!internalBodyBuffer()) |
450 return; | 454 return; |
451 refreshBody(internalBodyBuffer()->scriptState()); | 455 refreshBody(internalBodyBuffer()->scriptState()); |
452 } | 456 } |
453 | 457 |
454 void Response::refreshBody(ScriptState* scriptState) { | 458 void Response::refreshBody(ScriptState* scriptState) { |
455 v8::Local<v8::Value> bodyBuffer = toV8(internalBodyBuffer(), scriptState); | 459 v8::Local<v8::Value> bodyBuffer = toV8(internalBodyBuffer(), scriptState); |
456 v8::Local<v8::Value> response = toV8(this, scriptState); | 460 v8::Local<v8::Value> response = toV8(this, scriptState); |
457 if (response.IsEmpty()) { | 461 if (response.IsEmpty()) { |
458 // |toV8| can return an empty handle when the worker is terminating. | 462 // |toV8| can return an empty handle when the worker is terminating. |
459 // We don't want the renderer to crash in such cases. | 463 // We don't want the renderer to crash in such cases. |
460 // TODO(yhirano): Delete this block after the graceful shutdown | 464 // TODO(yhirano): Delete this block after the graceful shutdown |
461 // mechanism is introduced. | 465 // mechanism is introduced. |
462 return; | 466 return; |
463 } | 467 } |
464 DCHECK(response->IsObject()); | 468 DCHECK(response->IsObject()); |
465 V8HiddenValue::setHiddenValue( | 469 V8HiddenValue::setHiddenValue( |
466 scriptState, response.As<v8::Object>(), | 470 scriptState, response.As<v8::Object>(), |
467 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | 471 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); |
468 } | 472 } |
469 | 473 |
470 DEFINE_TRACE(Response) { | 474 DEFINE_TRACE(Response) { |
471 Body::trace(visitor); | 475 Body::trace(visitor); |
472 visitor->trace(m_response); | 476 visitor->trace(m_response); |
473 visitor->trace(m_headers); | 477 visitor->trace(m_headers); |
474 } | 478 } |
475 | 479 |
476 } // namespace blink | 480 } // namespace blink |
OLD | NEW |