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

Unified Diff: content/child/blink_platform_impl.cc

Issue 850043008: [DO NOT REVIEW][DO NOT COMMIT] Implement WebDataProducerHandleImpl. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/child/web_data_consumer_handle_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
}
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/child/web_data_consumer_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698