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 "bindings/core/v8/V8PrivateProperty.h" |
8 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
9 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
10 #include "core/loader/ThreadableLoader.h" | 11 #include "core/loader/ThreadableLoader.h" |
11 #include "modules/fetch/BodyStreamBuffer.h" | 12 #include "modules/fetch/BodyStreamBuffer.h" |
12 #include "modules/fetch/FetchManager.h" | 13 #include "modules/fetch/FetchManager.h" |
13 #include "modules/fetch/RequestInit.h" | 14 #include "modules/fetch/RequestInit.h" |
14 #include "platform/HTTPNames.h" | 15 #include "platform/HTTPNames.h" |
15 #include "platform/RuntimeEnabledFeatures.h" | 16 #include "platform/RuntimeEnabledFeatures.h" |
16 #include "platform/loader/fetch/FetchUtils.h" | 17 #include "platform/loader/fetch/FetchUtils.h" |
17 #include "platform/loader/fetch/ResourceLoaderOptions.h" | 18 #include "platform/loader/fetch/ResourceLoaderOptions.h" |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 // 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 |
711 // 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 |
712 // this information in to here. | 713 // this information in to here. |
713 } | 714 } |
714 | 715 |
715 String Request::mimeType() const { | 716 String Request::mimeType() const { |
716 return m_request->mimeType(); | 717 return m_request->mimeType(); |
717 } | 718 } |
718 | 719 |
719 void Request::refreshBody(ScriptState* scriptState) { | 720 void Request::refreshBody(ScriptState* scriptState) { |
720 v8::Local<v8::Value> bodyBuffer = ToV8(this->bodyBuffer(), scriptState); | |
721 v8::Local<v8::Value> request = ToV8(this, scriptState); | 721 v8::Local<v8::Value> request = ToV8(this, scriptState); |
722 if (request.IsEmpty()) { | 722 if (request.IsEmpty()) { |
723 // |toV8| can return an empty handle when the worker is terminating. | 723 // |toV8| can return an empty handle when the worker is terminating. |
724 // We don't want the renderer to crash in such cases. | 724 // We don't want the renderer to crash in such cases. |
725 // TODO(yhirano): Delete this block after the graceful shutdown | 725 // TODO(yhirano): Delete this block after the graceful shutdown |
726 // mechanism is introduced. | 726 // mechanism is introduced. |
727 return; | 727 return; |
728 } | 728 } |
729 DCHECK(request->IsObject()); | 729 DCHECK(request->IsObject()); |
730 V8HiddenValue::setHiddenValue( | 730 v8::Local<v8::Value> bodyBuffer = ToV8(this->bodyBuffer(), scriptState); |
731 scriptState, request.As<v8::Object>(), | 731 V8PrivateProperty::getInternalBodyBuffer(scriptState->isolate()) |
732 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | 732 .set(request.As<v8::Object>(), bodyBuffer); |
733 } | 733 } |
734 | 734 |
735 DEFINE_TRACE(Request) { | 735 DEFINE_TRACE(Request) { |
736 Body::trace(visitor); | 736 Body::trace(visitor); |
737 visitor->trace(m_request); | 737 visitor->trace(m_request); |
738 visitor->trace(m_headers); | 738 visitor->trace(m_headers); |
739 } | 739 } |
740 | 740 |
741 } // namespace blink | 741 } // namespace blink |
OLD | NEW |