Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp

Issue 2595543003: Rename toV8(...) function in Blink to ToV8(...). (Closed)
Patch Set: Rebasing... Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/BodyStreamBuffer.h" 5 #include "modules/fetch/BodyStreamBuffer.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/V8HiddenValue.h" 8 #include "bindings/core/v8/V8HiddenValue.h"
9 #include "bindings/core/v8/V8ThrowException.h" 9 #include "bindings/core/v8/V8ThrowException.h"
10 #include "core/dom/DOMArrayBuffer.h" 10 #include "core/dom/DOMArrayBuffer.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Member<BodyStreamBuffer> m_buffer; 74 Member<BodyStreamBuffer> m_buffer;
75 Member<FetchDataLoader::Client> m_client; 75 Member<FetchDataLoader::Client> m_client;
76 }; 76 };
77 77
78 BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, 78 BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState,
79 BytesConsumer* consumer) 79 BytesConsumer* consumer)
80 : UnderlyingSourceBase(scriptState), 80 : UnderlyingSourceBase(scriptState),
81 m_scriptState(scriptState), 81 m_scriptState(scriptState),
82 m_consumer(consumer), 82 m_consumer(consumer),
83 m_madeFromReadableStream(false) { 83 m_madeFromReadableStream(false) {
84 v8::Local<v8::Value> bodyValue = toV8(this, scriptState); 84 v8::Local<v8::Value> bodyValue = ToV8(this, scriptState);
85 DCHECK(!bodyValue.IsEmpty()); 85 DCHECK(!bodyValue.IsEmpty());
86 DCHECK(bodyValue->IsObject()); 86 DCHECK(bodyValue->IsObject());
87 v8::Local<v8::Object> body = bodyValue.As<v8::Object>(); 87 v8::Local<v8::Object> body = bodyValue.As<v8::Object>();
88 88
89 ScriptValue readableStream = ReadableStreamOperations::createReadableStream( 89 ScriptValue readableStream = ReadableStreamOperations::createReadableStream(
90 scriptState, this, 90 scriptState, this,
91 ReadableStreamOperations::createCountQueuingStrategy(scriptState, 0)); 91 ReadableStreamOperations::createCountQueuingStrategy(scriptState, 0));
92 DCHECK(!readableStream.isEmpty()); 92 DCHECK(!readableStream.isEmpty());
93 V8HiddenValue::setHiddenValue( 93 V8HiddenValue::setHiddenValue(
94 scriptState, body, 94 scriptState, body,
95 V8HiddenValue::internalBodyStream(scriptState->isolate()), 95 V8HiddenValue::internalBodyStream(scriptState->isolate()),
96 readableStream.v8Value()); 96 readableStream.v8Value());
97 m_consumer->setClient(this); 97 m_consumer->setClient(this);
98 onStateChange(); 98 onStateChange();
99 } 99 }
100 100
101 BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, ScriptValue stream) 101 BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, ScriptValue stream)
102 : UnderlyingSourceBase(scriptState), 102 : UnderlyingSourceBase(scriptState),
103 m_scriptState(scriptState), 103 m_scriptState(scriptState),
104 m_madeFromReadableStream(true) { 104 m_madeFromReadableStream(true) {
105 DCHECK(ReadableStreamOperations::isReadableStream(scriptState, stream)); 105 DCHECK(ReadableStreamOperations::isReadableStream(scriptState, stream));
106 v8::Local<v8::Value> bodyValue = toV8(this, scriptState); 106 v8::Local<v8::Value> bodyValue = ToV8(this, scriptState);
107 DCHECK(!bodyValue.IsEmpty()); 107 DCHECK(!bodyValue.IsEmpty());
108 DCHECK(bodyValue->IsObject()); 108 DCHECK(bodyValue->IsObject());
109 v8::Local<v8::Object> body = bodyValue.As<v8::Object>(); 109 v8::Local<v8::Object> body = bodyValue.As<v8::Object>();
110 110
111 V8HiddenValue::setHiddenValue( 111 V8HiddenValue::setHiddenValue(
112 scriptState, body, 112 scriptState, body,
113 V8HiddenValue::internalBodyStream(scriptState->isolate()), 113 V8HiddenValue::internalBodyStream(scriptState->isolate()),
114 stream.v8Value()); 114 stream.v8Value());
115 } 115 }
116 116
117 ScriptValue BodyStreamBuffer::stream() { 117 ScriptValue BodyStreamBuffer::stream() {
118 ScriptState::Scope scope(m_scriptState.get()); 118 ScriptState::Scope scope(m_scriptState.get());
119 v8::Local<v8::Value> bodyValue = toV8(this, m_scriptState.get()); 119 v8::Local<v8::Value> bodyValue = ToV8(this, m_scriptState.get());
120 DCHECK(!bodyValue.IsEmpty()); 120 DCHECK(!bodyValue.IsEmpty());
121 DCHECK(bodyValue->IsObject()); 121 DCHECK(bodyValue->IsObject());
122 v8::Local<v8::Object> body = bodyValue.As<v8::Object>(); 122 v8::Local<v8::Object> body = bodyValue.As<v8::Object>();
123 return ScriptValue( 123 return ScriptValue(
124 m_scriptState.get(), 124 m_scriptState.get(),
125 V8HiddenValue::getHiddenValue( 125 V8HiddenValue::getHiddenValue(
126 m_scriptState.get(), body, 126 m_scriptState.get(), body,
127 V8HiddenValue::internalBodyStream(m_scriptState->isolate()))); 127 V8HiddenValue::internalBodyStream(m_scriptState->isolate())));
128 } 128 }
129 129
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 384 }
385 if (isErrored) 385 if (isErrored)
386 return BytesConsumer::createErrored(BytesConsumer::Error("error")); 386 return BytesConsumer::createErrored(BytesConsumer::Error("error"));
387 387
388 DCHECK(consumer); 388 DCHECK(consumer);
389 consumer->clearClient(); 389 consumer->clearClient();
390 return consumer; 390 return consumer;
391 } 391 }
392 392
393 } // namespace blink 393 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.cpp ('k') | third_party/WebKit/Source/modules/fetch/Request.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698