| 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 <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "base/threading/thread.h" | 28 #include "base/threading/thread.h" |
| 29 #include "base/threading/thread_task_runner_handle.h" | 29 #include "base/threading/thread_task_runner_handle.h" |
| 30 #include "base/time/time.h" | 30 #include "base/time/time.h" |
| 31 #include "base/trace_event/memory_allocator_dump_guid.h" | 31 #include "base/trace_event/memory_allocator_dump_guid.h" |
| 32 #include "base/trace_event/memory_dump_manager.h" | 32 #include "base/trace_event/memory_dump_manager.h" |
| 33 #include "base/trace_event/trace_event.h" | 33 #include "base/trace_event/trace_event.h" |
| 34 #include "blink/public/resources/grit/blink_image_resources.h" | 34 #include "blink/public/resources/grit/blink_image_resources.h" |
| 35 #include "blink/public/resources/grit/blink_resources.h" | 35 #include "blink/public/resources/grit/blink_resources.h" |
| 36 #include "build/build_config.h" | 36 #include "build/build_config.h" |
| 37 #include "components/mime_util/mime_util.h" | 37 #include "components/mime_util/mime_util.h" |
| 38 #include "components/scheduler/child/web_task_runner_impl.h" | |
| 39 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | |
| 40 #include "content/app/resources/grit/content_resources.h" | 38 #include "content/app/resources/grit/content_resources.h" |
| 41 #include "content/app/strings/grit/content_strings.h" | 39 #include "content/app/strings/grit/content_strings.h" |
| 42 #include "content/child/background_sync/background_sync_provider.h" | 40 #include "content/child/background_sync/background_sync_provider.h" |
| 43 #include "content/child/child_thread_impl.h" | 41 #include "content/child/child_thread_impl.h" |
| 44 #include "content/child/content_child_helpers.h" | 42 #include "content/child/content_child_helpers.h" |
| 45 #include "content/child/notifications/notification_dispatcher.h" | 43 #include "content/child/notifications/notification_dispatcher.h" |
| 46 #include "content/child/notifications/notification_manager.h" | 44 #include "content/child/notifications/notification_manager.h" |
| 47 #include "content/child/push_messaging/push_dispatcher.h" | 45 #include "content/child/push_messaging/push_dispatcher.h" |
| 48 #include "content/child/push_messaging/push_provider.h" | 46 #include "content/child/push_messaging/push_provider.h" |
| 49 #include "content/child/thread_safe_sender.h" | 47 #include "content/child/thread_safe_sender.h" |
| 50 #include "content/child/web_url_loader_impl.h" | 48 #include "content/child/web_url_loader_impl.h" |
| 51 #include "content/child/web_url_request_util.h" | 49 #include "content/child/web_url_request_util.h" |
| 52 #include "content/child/websocket_bridge.h" | 50 #include "content/child/websocket_bridge.h" |
| 53 #include "content/child/worker_thread_registry.h" | 51 #include "content/child/worker_thread_registry.h" |
| 54 #include "content/public/common/content_client.h" | 52 #include "content/public/common/content_client.h" |
| 55 #include "net/base/data_url.h" | 53 #include "net/base/data_url.h" |
| 56 #include "net/base/net_errors.h" | 54 #include "net/base/net_errors.h" |
| 57 #include "third_party/WebKit/public/platform/WebData.h" | 55 #include "third_party/WebKit/public/platform/WebData.h" |
| 58 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 56 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 59 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 57 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 60 #include "third_party/WebKit/public/platform/WebString.h" | 58 #include "third_party/WebKit/public/platform/WebString.h" |
| 61 #include "third_party/WebKit/public/platform/WebURL.h" | 59 #include "third_party/WebKit/public/platform/WebURL.h" |
| 60 #include "third_party/WebKit/public/platform/scheduler/child/webthread_impl_for_
worker_scheduler.h" |
| 62 #include "ui/base/layout.h" | 61 #include "ui/base/layout.h" |
| 63 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" | 62 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
| 64 #include "ui/events/keycodes/dom/keycode_converter.h" | 63 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 65 | 64 |
| 66 using blink::WebData; | 65 using blink::WebData; |
| 67 using blink::WebFallbackThemeEngine; | 66 using blink::WebFallbackThemeEngine; |
| 68 using blink::WebLocalizedString; | 67 using blink::WebLocalizedString; |
| 69 using blink::WebString; | 68 using blink::WebString; |
| 70 using blink::WebThemeEngine; | 69 using blink::WebThemeEngine; |
| 71 using blink::WebURL; | 70 using blink::WebURL; |
| 72 using blink::WebURLError; | 71 using blink::WebURLError; |
| 73 using blink::WebURLLoader; | 72 using blink::WebURLLoader; |
| 74 using scheduler::WebThreadImplForWorkerScheduler; | 73 using blink::scheduler::WebThreadImplForWorkerScheduler; |
| 75 | 74 |
| 76 namespace content { | 75 namespace content { |
| 77 | 76 |
| 78 namespace { | 77 namespace { |
| 79 | 78 |
| 80 | 79 |
| 81 } // namespace | 80 } // namespace |
| 82 | 81 |
| 83 static int ToMessageID(WebLocalizedString::Name name) { | 82 static int ToMessageID(WebLocalizedString::Name name) { |
| 84 switch (name) { | 83 switch (name) { |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); | 382 thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender(); |
| 384 notification_dispatcher_ = | 383 notification_dispatcher_ = |
| 385 ChildThreadImpl::current()->notification_dispatcher(); | 384 ChildThreadImpl::current()->notification_dispatcher(); |
| 386 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); | 385 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); |
| 387 main_thread_sync_provider_.reset( | 386 main_thread_sync_provider_.reset( |
| 388 new BackgroundSyncProvider(main_thread_task_runner_.get())); | 387 new BackgroundSyncProvider(main_thread_task_runner_.get())); |
| 389 } | 388 } |
| 390 } | 389 } |
| 391 | 390 |
| 392 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate( | 391 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate( |
| 393 scheduler::WebThreadBase* thread) { | 392 blink::scheduler::WebThreadBase* thread) { |
| 394 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 393 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 395 base::WaitableEvent::InitialState::NOT_SIGNALED); | 394 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 396 thread->GetTaskRunner()->PostTask( | 395 thread->GetTaskRunner()->PostTask( |
| 397 FROM_HERE, | 396 FROM_HERE, |
| 398 base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this), | 397 base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this), |
| 399 base::Unretained(thread), base::Unretained(&event))); | 398 base::Unretained(thread), base::Unretained(&event))); |
| 400 event.Wait(); | 399 event.Wait(); |
| 401 } | 400 } |
| 402 | 401 |
| 403 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread, | 402 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 | 446 |
| 448 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { | 447 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { |
| 449 std::unique_ptr<WebThreadImplForWorkerScheduler> thread( | 448 std::unique_ptr<WebThreadImplForWorkerScheduler> thread( |
| 450 new WebThreadImplForWorkerScheduler(name)); | 449 new WebThreadImplForWorkerScheduler(name)); |
| 451 thread->Init(); | 450 thread->Init(); |
| 452 WaitUntilWebThreadTLSUpdate(thread.get()); | 451 WaitUntilWebThreadTLSUpdate(thread.get()); |
| 453 return thread.release(); | 452 return thread.release(); |
| 454 } | 453 } |
| 455 | 454 |
| 456 void BlinkPlatformImpl::SetCompositorThread( | 455 void BlinkPlatformImpl::SetCompositorThread( |
| 457 scheduler::WebThreadBase* compositor_thread) { | 456 blink::scheduler::WebThreadBase* compositor_thread) { |
| 458 compositor_thread_ = compositor_thread; | 457 compositor_thread_ = compositor_thread; |
| 459 if (compositor_thread_) | 458 if (compositor_thread_) |
| 460 WaitUntilWebThreadTLSUpdate(compositor_thread_); | 459 WaitUntilWebThreadTLSUpdate(compositor_thread_); |
| 461 } | 460 } |
| 462 | 461 |
| 463 blink::WebThread* BlinkPlatformImpl::currentThread() { | 462 blink::WebThread* BlinkPlatformImpl::currentThread() { |
| 464 return static_cast<blink::WebThread*>(current_thread_slot_.Get()); | 463 return static_cast<blink::WebThread*>(current_thread_slot_.Get()); |
| 465 } | 464 } |
| 466 | 465 |
| 467 void BlinkPlatformImpl::recordAction(const blink::UserMetricsAction& name) { | 466 void BlinkPlatformImpl::recordAction(const blink::UserMetricsAction& name) { |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 987 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
| 989 static_cast<ui::DomKey>(dom_key))); | 988 static_cast<ui::DomKey>(dom_key))); |
| 990 } | 989 } |
| 991 | 990 |
| 992 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 991 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
| 993 return static_cast<int>( | 992 return static_cast<int>( |
| 994 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 993 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
| 995 } | 994 } |
| 996 | 995 |
| 997 } // namespace content | 996 } // namespace content |
| OLD | NEW |