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

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another GYP fix Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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
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/permissions/permission_dispatcher.h" 45 #include "content/child/permissions/permission_dispatcher.h"
48 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" 46 #include "content/child/permissions/permission_dispatcher_thread_proxy.h"
49 #include "content/child/push_messaging/push_dispatcher.h" 47 #include "content/child/push_messaging/push_dispatcher.h"
50 #include "content/child/push_messaging/push_provider.h" 48 #include "content/child/push_messaging/push_provider.h"
51 #include "content/child/thread_safe_sender.h" 49 #include "content/child/thread_safe_sender.h"
52 #include "content/child/web_url_loader_impl.h" 50 #include "content/child/web_url_loader_impl.h"
53 #include "content/child/web_url_request_util.h" 51 #include "content/child/web_url_request_util.h"
54 #include "content/child/websocket_bridge.h" 52 #include "content/child/websocket_bridge.h"
55 #include "content/child/worker_thread_registry.h" 53 #include "content/child/worker_thread_registry.h"
56 #include "content/public/common/content_client.h" 54 #include "content/public/common/content_client.h"
57 #include "net/base/data_url.h" 55 #include "net/base/data_url.h"
58 #include "net/base/net_errors.h" 56 #include "net/base/net_errors.h"
59 #include "third_party/WebKit/public/platform/WebData.h" 57 #include "third_party/WebKit/public/platform/WebData.h"
60 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 58 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
61 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 59 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
62 #include "third_party/WebKit/public/platform/WebString.h" 60 #include "third_party/WebKit/public/platform/WebString.h"
63 #include "third_party/WebKit/public/platform/WebURL.h" 61 #include "third_party/WebKit/public/platform/WebURL.h"
62 #include "third_party/WebKit/public/platform/scheduler/child/webthread_impl_for_ worker_scheduler.h"
64 #include "ui/base/layout.h" 63 #include "ui/base/layout.h"
65 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" 64 #include "ui/events/gestures/blink/web_gesture_curve_impl.h"
66 #include "ui/events/keycodes/dom/keycode_converter.h" 65 #include "ui/events/keycodes/dom/keycode_converter.h"
67 66
68 using blink::WebData; 67 using blink::WebData;
69 using blink::WebFallbackThemeEngine; 68 using blink::WebFallbackThemeEngine;
70 using blink::WebLocalizedString; 69 using blink::WebLocalizedString;
71 using blink::WebString; 70 using blink::WebString;
72 using blink::WebThemeEngine; 71 using blink::WebThemeEngine;
73 using blink::WebURL; 72 using blink::WebURL;
74 using blink::WebURLError; 73 using blink::WebURLError;
75 using blink::WebURLLoader; 74 using blink::WebURLLoader;
76 using scheduler::WebThreadImplForWorkerScheduler; 75 using blink::scheduler::WebThreadImplForWorkerScheduler;
77 76
78 namespace content { 77 namespace content {
79 78
80 namespace { 79 namespace {
81 80
82 81
83 } // namespace 82 } // namespace
84 83
85 static int ToMessageID(WebLocalizedString::Name name) { 84 static int ToMessageID(WebLocalizedString::Name name) {
86 switch (name) { 85 switch (name) {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 ChildThreadImpl::current()->notification_dispatcher(); 386 ChildThreadImpl::current()->notification_dispatcher();
388 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher(); 387 push_dispatcher_ = ChildThreadImpl::current()->push_dispatcher();
389 permission_client_.reset(new PermissionDispatcher( 388 permission_client_.reset(new PermissionDispatcher(
390 ChildThreadImpl::current()->GetRemoteInterfaces())); 389 ChildThreadImpl::current()->GetRemoteInterfaces()));
391 main_thread_sync_provider_.reset( 390 main_thread_sync_provider_.reset(
392 new BackgroundSyncProvider(main_thread_task_runner_.get())); 391 new BackgroundSyncProvider(main_thread_task_runner_.get()));
393 } 392 }
394 } 393 }
395 394
396 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate( 395 void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate(
397 scheduler::WebThreadBase* thread) { 396 blink::scheduler::WebThreadBase* thread) {
398 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, 397 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
399 base::WaitableEvent::InitialState::NOT_SIGNALED); 398 base::WaitableEvent::InitialState::NOT_SIGNALED);
400 thread->GetTaskRunner()->PostTask( 399 thread->GetTaskRunner()->PostTask(
401 FROM_HERE, 400 FROM_HERE,
402 base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this), 401 base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this),
403 base::Unretained(thread), base::Unretained(&event))); 402 base::Unretained(thread), base::Unretained(&event)));
404 event.Wait(); 403 event.Wait();
405 } 404 }
406 405
407 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread, 406 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 450
452 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { 451 blink::WebThread* BlinkPlatformImpl::createThread(const char* name) {
453 std::unique_ptr<WebThreadImplForWorkerScheduler> thread( 452 std::unique_ptr<WebThreadImplForWorkerScheduler> thread(
454 new WebThreadImplForWorkerScheduler(name)); 453 new WebThreadImplForWorkerScheduler(name));
455 thread->Init(); 454 thread->Init();
456 WaitUntilWebThreadTLSUpdate(thread.get()); 455 WaitUntilWebThreadTLSUpdate(thread.get());
457 return thread.release(); 456 return thread.release();
458 } 457 }
459 458
460 void BlinkPlatformImpl::SetCompositorThread( 459 void BlinkPlatformImpl::SetCompositorThread(
461 scheduler::WebThreadBase* compositor_thread) { 460 blink::scheduler::WebThreadBase* compositor_thread) {
462 compositor_thread_ = compositor_thread; 461 compositor_thread_ = compositor_thread;
463 if (compositor_thread_) 462 if (compositor_thread_)
464 WaitUntilWebThreadTLSUpdate(compositor_thread_); 463 WaitUntilWebThreadTLSUpdate(compositor_thread_);
465 } 464 }
466 465
467 blink::WebThread* BlinkPlatformImpl::currentThread() { 466 blink::WebThread* BlinkPlatformImpl::currentThread() {
468 return static_cast<blink::WebThread*>(current_thread_slot_.Get()); 467 return static_cast<blink::WebThread*>(current_thread_slot_.Get());
469 } 468 }
470 469
471 void BlinkPlatformImpl::recordAction(const blink::UserMetricsAction& name) { 470 void BlinkPlatformImpl::recordAction(const blink::UserMetricsAction& name) {
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( 1002 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString(
1004 static_cast<ui::DomKey>(dom_key))); 1003 static_cast<ui::DomKey>(dom_key)));
1005 } 1004 }
1006 1005
1007 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { 1006 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) {
1008 return static_cast<int>( 1007 return static_cast<int>(
1009 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); 1008 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8()));
1010 } 1009 }
1011 1010
1012 } // namespace content 1011 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698