Index: content/child/blink_platform_impl.cc |
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc |
index e0ef4c9e7b12448595588d426da5e33e7e081874..60b9493ab70b53297e866ae8613c4cc68078ca2d 100644 |
--- a/content/child/blink_platform_impl.cc |
+++ b/content/child/blink_platform_impl.cc |
@@ -40,6 +40,8 @@ |
#include "content/child/push_messaging/push_dispatcher.h" |
#include "content/child/push_messaging/push_provider.h" |
#include "content/child/thread_safe_sender.h" |
+#include "content/child/web_data_consumer_handle_impl.h" |
+#include "content/child/web_data_producer_handle_impl.h" |
#include "content/child/web_discardable_memory_impl.h" |
#include "content/child/web_gesture_curve_impl.h" |
#include "content/child/web_url_loader_impl.h" |
@@ -47,11 +49,14 @@ |
#include "content/child/webthread_impl.h" |
#include "content/child/worker_task_runner.h" |
#include "content/public/common/content_client.h" |
+#include "mojo/public/c/system/data_pipe.h" |
+#include "mojo/public/c/system/types.h" |
#include "net/base/data_url.h" |
#include "net/base/mime_util.h" |
#include "net/base/net_errors.h" |
#include "net/base/net_util.h" |
#include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" |
+#include "third_party/WebKit/public/platform/WebCreateDataPipeOptions.h" |
#include "third_party/WebKit/public/platform/WebData.h" |
#include "third_party/WebKit/public/platform/WebFloatPoint.h" |
#include "third_party/WebKit/public/platform/WebString.h" |
@@ -1078,6 +1083,41 @@ BlinkPlatformImpl::navigatorConnectProvider() { |
thread_safe_sender_.get(), main_thread_task_runner_); |
} |
+bool BlinkPlatformImpl::createDataPipe( |
+ const blink::WebCreateDataPipeOptions* options, |
+ blink::WebDataProducerHandle** producer, |
+ blink::WebDataConsumerHandle** consumer) { |
+ |
+ MojoCreateDataPipeOptions options_entity; |
+ const MojoCreateDataPipeOptions* options_to_pass = nullptr; |
+ if (options) { |
+ options_entity.struct_size = sizeof(MojoCreateDataPipeOptions); |
+ options_entity.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE; |
+ if (options->flags & options->FlagMayDiscard) |
+ options_entity.flags |= MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD; |
+ |
+ options_entity.element_num_bytes = options->elementNumBytes; |
+ options_entity.capacity_num_bytes = options->capacityNumBytes; |
+ options_to_pass = &options_entity; |
+ } |
+ |
+ mojo::ScopedDataPipeProducerHandle mojo_producer; |
+ mojo::ScopedDataPipeConsumerHandle mojo_consumer; |
+ |
+ MojoResult result = |
+ mojo::CreateDataPipe(options_to_pass, &mojo_producer, &mojo_consumer); |
+ |
+ if (result != MOJO_RESULT_OK) { |
+ *producer = nullptr; |
+ *consumer = nullptr; |
+ return false; |
+ } |
+ |
+ *producer = new WebDataProducerHandleImpl(mojo_producer.Pass()); |
+ *consumer = new WebDataConsumerHandleImpl(mojo_consumer.Pass()); |
+ return true; |
+} |
+ |
WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
return &native_theme_engine_; |
} |