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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 // to plumb this information in to here. | 671 // to plumb this information in to here. |
672 } | 672 } |
673 | 673 |
674 String Request::mimeType() const | 674 String Request::mimeType() const |
675 { | 675 { |
676 return m_request->mimeType(); | 676 return m_request->mimeType(); |
677 } | 677 } |
678 | 678 |
679 void Request::refreshBody(ScriptState* scriptState) | 679 void Request::refreshBody(ScriptState* scriptState) |
680 { | 680 { |
681 ScriptState::Scope scope(scriptState); | |
682 v8::Local<v8::Value> bodyBuffer = toV8(this->bodyBuffer(), scriptState); | 681 v8::Local<v8::Value> bodyBuffer = toV8(this->bodyBuffer(), scriptState); |
683 v8::Local<v8::Value> request = toV8(this, scriptState); | 682 v8::Local<v8::Value> request = toV8(this, scriptState); |
684 if (request.IsEmpty()) { | 683 if (request.IsEmpty()) { |
685 // |toV8| can return an empty handle when the worker is terminating. | 684 // |toV8| can return an empty handle when the worker is terminating. |
686 // We don't want the renderer to crash in such cases. | 685 // We don't want the renderer to crash in such cases. |
687 // TODO(yhirano): Delete this block after the graceful shutdown | 686 // TODO(yhirano): Delete this block after the graceful shutdown |
688 // mechanism is introduced. | 687 // mechanism is introduced. |
689 return; | 688 return; |
690 } | 689 } |
691 DCHECK(request->IsObject()); | 690 DCHECK(request->IsObject()); |
692 V8HiddenValue::setHiddenValue(scriptState, request.As<v8::Object>(), V8Hidde
nValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | 691 V8HiddenValue::setHiddenValue(scriptState, request.As<v8::Object>(), V8Hidde
nValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); |
693 } | 692 } |
694 | 693 |
695 DEFINE_TRACE(Request) | 694 DEFINE_TRACE(Request) |
696 { | 695 { |
697 Body::trace(visitor); | 696 Body::trace(visitor); |
698 visitor->trace(m_request); | 697 visitor->trace(m_request); |
699 visitor->trace(m_headers); | 698 visitor->trace(m_headers); |
700 } | 699 } |
701 | 700 |
702 } // namespace blink | 701 } // namespace blink |
OLD | NEW |