| 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/Request.h" | 5 #include "modules/fetch/Request.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
| 10 #include "core/fetch/FetchUtils.h" | 10 #include "core/fetch/FetchUtils.h" |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 // FIXME: How can we set isReload properly? What is the correct place to load | 711 // FIXME: How can we set isReload properly? What is the correct place to load |
| 712 // it in to the Request object? We should investigate the right way to plumb | 712 // it in to the Request object? We should investigate the right way to plumb |
| 713 // this information in to here. | 713 // this information in to here. |
| 714 } | 714 } |
| 715 | 715 |
| 716 String Request::mimeType() const { | 716 String Request::mimeType() const { |
| 717 return m_request->mimeType(); | 717 return m_request->mimeType(); |
| 718 } | 718 } |
| 719 | 719 |
| 720 void Request::refreshBody(ScriptState* scriptState) { | 720 void Request::refreshBody(ScriptState* scriptState) { |
| 721 v8::Local<v8::Value> bodyBuffer = toV8(this->bodyBuffer(), scriptState); | 721 v8::Local<v8::Value> bodyBuffer = ToV8(this->bodyBuffer(), scriptState); |
| 722 v8::Local<v8::Value> request = toV8(this, scriptState); | 722 v8::Local<v8::Value> request = ToV8(this, scriptState); |
| 723 if (request.IsEmpty()) { | 723 if (request.IsEmpty()) { |
| 724 // |toV8| can return an empty handle when the worker is terminating. | 724 // |toV8| can return an empty handle when the worker is terminating. |
| 725 // We don't want the renderer to crash in such cases. | 725 // We don't want the renderer to crash in such cases. |
| 726 // TODO(yhirano): Delete this block after the graceful shutdown | 726 // TODO(yhirano): Delete this block after the graceful shutdown |
| 727 // mechanism is introduced. | 727 // mechanism is introduced. |
| 728 return; | 728 return; |
| 729 } | 729 } |
| 730 DCHECK(request->IsObject()); | 730 DCHECK(request->IsObject()); |
| 731 V8HiddenValue::setHiddenValue( | 731 V8HiddenValue::setHiddenValue( |
| 732 scriptState, request.As<v8::Object>(), | 732 scriptState, request.As<v8::Object>(), |
| 733 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | 733 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); |
| 734 } | 734 } |
| 735 | 735 |
| 736 DEFINE_TRACE(Request) { | 736 DEFINE_TRACE(Request) { |
| 737 Body::trace(visitor); | 737 Body::trace(visitor); |
| 738 visitor->trace(m_request); | 738 visitor->trace(m_request); |
| 739 visitor->trace(m_headers); | 739 visitor->trace(m_headers); |
| 740 } | 740 } |
| 741 | 741 |
| 742 } // namespace blink | 742 } // namespace blink |
| OLD | NEW |