| Index: Source/core/testing/ReadableStreamTestRequest.cpp
|
| diff --git a/Source/core/testing/ReadableStreamTestRequest.cpp b/Source/core/testing/ReadableStreamTestRequest.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bd11fac0c11f8b9f88de963023de79f64df75370
|
| --- /dev/null
|
| +++ b/Source/core/testing/ReadableStreamTestRequest.cpp
|
| @@ -0,0 +1,43 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "core/testing/ReadableStreamTestRequest.h"
|
| +
|
| +#include "bindings/core/v8/ToV8.h"
|
| +#include "bindings/core/v8/V8Binding.h"
|
| +#include "bindings/core/v8/V8HiddenValue.h"
|
| +#include "core/streams/ReadableStream2.h"
|
| +#include <v8.h>
|
| +
|
| +namespace blink {
|
| +
|
| +ReadableStreamTestRequest::ReadableStreamTestRequest(ScriptState* scriptState, UnderlyingSourceBase* underlyingSource)
|
| +{
|
| + ScriptState::Scope scope(scriptState);
|
| +
|
| + v8::Local<v8::Context> context = scriptState->context();
|
| + v8::Local<v8::Object> global = context->Global();
|
| + v8::Isolate* isolate = scriptState->isolate();
|
| + v8::Local<v8::Object> jsRequest = toV8(this, global, isolate).As<v8::Object>();
|
| +
|
| + ScriptValue strategy = JSStreams::createCountQueuingStrategy(scriptState, 10);
|
| + ScriptValue stream = JSStreams::createReadableStream(scriptState, underlyingSource, strategy);
|
| +
|
| + V8HiddenValue::setHiddenValue(isolate, jsRequest, V8HiddenValue::bodyStream(isolate), stream.v8Value());
|
| +}
|
| +
|
| +ScriptValue ReadableStreamTestRequest::body(ScriptState* scriptState)
|
| +{
|
| + ScriptState::Scope scope(scriptState);
|
| + v8::Isolate* isolate = scriptState->isolate();
|
| + v8::Local<v8::Object> global = scriptState->context()->Global();
|
| + v8::Local<v8::Object> jsRequest = toV8(this, global, isolate).As<v8::Object>();
|
| +
|
| + v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue(isolate, jsRequest, V8HiddenValue::bodyStream(isolate));
|
| +
|
| + return ScriptValue(scriptState, result);
|
| +}
|
| +
|
| +}
|
|
|