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 "content/child/blink_platform_impl.h" | 5 #include "content/child/blink_platform_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "content/child/bluetooth/web_bluetooth_impl.h" | 33 #include "content/child/bluetooth/web_bluetooth_impl.h" |
34 #include "content/child/child_thread.h" | 34 #include "content/child/child_thread.h" |
35 #include "content/child/content_child_helpers.h" | 35 #include "content/child/content_child_helpers.h" |
36 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 36 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
37 #include "content/child/navigator_connect/navigator_connect_provider.h" | 37 #include "content/child/navigator_connect/navigator_connect_provider.h" |
38 #include "content/child/notifications/notification_dispatcher.h" | 38 #include "content/child/notifications/notification_dispatcher.h" |
39 #include "content/child/notifications/notification_manager.h" | 39 #include "content/child/notifications/notification_manager.h" |
40 #include "content/child/push_messaging/push_dispatcher.h" | 40 #include "content/child/push_messaging/push_dispatcher.h" |
41 #include "content/child/push_messaging/push_provider.h" | 41 #include "content/child/push_messaging/push_provider.h" |
42 #include "content/child/thread_safe_sender.h" | 42 #include "content/child/thread_safe_sender.h" |
| 43 #include "content/child/web_data_consumer_handle_impl.h" |
| 44 #include "content/child/web_data_producer_handle_impl.h" |
43 #include "content/child/web_discardable_memory_impl.h" | 45 #include "content/child/web_discardable_memory_impl.h" |
44 #include "content/child/web_gesture_curve_impl.h" | 46 #include "content/child/web_gesture_curve_impl.h" |
45 #include "content/child/web_url_loader_impl.h" | 47 #include "content/child/web_url_loader_impl.h" |
46 #include "content/child/websocket_bridge.h" | 48 #include "content/child/websocket_bridge.h" |
47 #include "content/child/webthread_impl.h" | 49 #include "content/child/webthread_impl.h" |
48 #include "content/child/worker_task_runner.h" | 50 #include "content/child/worker_task_runner.h" |
49 #include "content/public/common/content_client.h" | 51 #include "content/public/common/content_client.h" |
| 52 #include "mojo/public/c/system/data_pipe.h" |
| 53 #include "mojo/public/c/system/types.h" |
50 #include "net/base/data_url.h" | 54 #include "net/base/data_url.h" |
51 #include "net/base/mime_util.h" | 55 #include "net/base/mime_util.h" |
52 #include "net/base/net_errors.h" | 56 #include "net/base/net_errors.h" |
53 #include "net/base/net_util.h" | 57 #include "net/base/net_util.h" |
54 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" | 58 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" |
| 59 #include "third_party/WebKit/public/platform/WebCreateDataPipeOptions.h" |
55 #include "third_party/WebKit/public/platform/WebData.h" | 60 #include "third_party/WebKit/public/platform/WebData.h" |
56 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 61 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
57 #include "third_party/WebKit/public/platform/WebString.h" | 62 #include "third_party/WebKit/public/platform/WebString.h" |
58 #include "third_party/WebKit/public/platform/WebURL.h" | 63 #include "third_party/WebKit/public/platform/WebURL.h" |
59 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 64 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
60 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 65 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
61 #include "ui/base/layout.h" | 66 #include "ui/base/layout.h" |
62 | 67 |
63 using blink::WebData; | 68 using blink::WebData; |
64 using blink::WebFallbackThemeEngine; | 69 using blink::WebFallbackThemeEngine; |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 | 1076 |
1072 blink::WebNavigatorConnectProvider* | 1077 blink::WebNavigatorConnectProvider* |
1073 BlinkPlatformImpl::navigatorConnectProvider() { | 1078 BlinkPlatformImpl::navigatorConnectProvider() { |
1074 if (!thread_safe_sender_.get()) | 1079 if (!thread_safe_sender_.get()) |
1075 return nullptr; | 1080 return nullptr; |
1076 | 1081 |
1077 return NavigatorConnectProvider::ThreadSpecificInstance( | 1082 return NavigatorConnectProvider::ThreadSpecificInstance( |
1078 thread_safe_sender_.get(), main_thread_task_runner_); | 1083 thread_safe_sender_.get(), main_thread_task_runner_); |
1079 } | 1084 } |
1080 | 1085 |
| 1086 bool BlinkPlatformImpl::createDataPipe( |
| 1087 const blink::WebCreateDataPipeOptions* options, |
| 1088 blink::WebDataProducerHandle** producer, |
| 1089 blink::WebDataConsumerHandle** consumer) { |
| 1090 |
| 1091 MojoCreateDataPipeOptions options_entity; |
| 1092 const MojoCreateDataPipeOptions* options_to_pass = nullptr; |
| 1093 if (options) { |
| 1094 options_entity.struct_size = sizeof(MojoCreateDataPipeOptions); |
| 1095 options_entity.flags = MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE; |
| 1096 if (options->flags & options->FlagMayDiscard) |
| 1097 options_entity.flags |= MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD; |
| 1098 |
| 1099 options_entity.element_num_bytes = options->elementNumBytes; |
| 1100 options_entity.capacity_num_bytes = options->capacityNumBytes; |
| 1101 options_to_pass = &options_entity; |
| 1102 } |
| 1103 |
| 1104 mojo::ScopedDataPipeProducerHandle mojo_producer; |
| 1105 mojo::ScopedDataPipeConsumerHandle mojo_consumer; |
| 1106 |
| 1107 MojoResult result = |
| 1108 mojo::CreateDataPipe(options_to_pass, &mojo_producer, &mojo_consumer); |
| 1109 |
| 1110 if (result != MOJO_RESULT_OK) { |
| 1111 *producer = nullptr; |
| 1112 *consumer = nullptr; |
| 1113 return false; |
| 1114 } |
| 1115 |
| 1116 *producer = new WebDataProducerHandleImpl(mojo_producer.Pass()); |
| 1117 *consumer = new WebDataConsumerHandleImpl(mojo_consumer.Pass()); |
| 1118 return true; |
| 1119 } |
| 1120 |
1081 WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 1121 WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
1082 return &native_theme_engine_; | 1122 return &native_theme_engine_; |
1083 } | 1123 } |
1084 | 1124 |
1085 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { | 1125 WebFallbackThemeEngine* BlinkPlatformImpl::fallbackThemeEngine() { |
1086 return &fallback_theme_engine_; | 1126 return &fallback_theme_engine_; |
1087 } | 1127 } |
1088 | 1128 |
1089 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( | 1129 blink::Platform::FileHandle BlinkPlatformImpl::databaseOpenFile( |
1090 const blink::WebString& vfs_file_name, int desired_flags) { | 1130 const blink::WebString& vfs_file_name, int desired_flags) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 } | 1275 } |
1236 | 1276 |
1237 // static | 1277 // static |
1238 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 1278 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
1239 WebThreadImplForMessageLoop* impl = | 1279 WebThreadImplForMessageLoop* impl = |
1240 static_cast<WebThreadImplForMessageLoop*>(thread); | 1280 static_cast<WebThreadImplForMessageLoop*>(thread); |
1241 delete impl; | 1281 delete impl; |
1242 } | 1282 } |
1243 | 1283 |
1244 } // namespace content | 1284 } // namespace content |
OLD | NEW |