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