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

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

Issue 1366883002: [Reland] Post loading tasks on the appropriate WebFrameScheduler's queue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a clone method to WebTaskRunner which lets us solve the lifetime issue. Created 5 years, 2 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 <vector> 9 #include <vector>
10 10
(...skipping 16 matching lines...) Expand all
27 #include "base/sys_info.h" 27 #include "base/sys_info.h"
28 #include "base/thread_task_runner_handle.h" 28 #include "base/thread_task_runner_handle.h"
29 #include "base/threading/platform_thread.h" 29 #include "base/threading/platform_thread.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 "components/mime_util/mime_util.h" 36 #include "components/mime_util/mime_util.h"
37 #include "components/scheduler/child/web_task_runner_impl.h"
37 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" 38 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h"
38 #include "content/app/resources/grit/content_resources.h" 39 #include "content/app/resources/grit/content_resources.h"
39 #include "content/app/strings/grit/content_strings.h" 40 #include "content/app/strings/grit/content_strings.h"
40 #include "content/child/background_sync/background_sync_provider.h" 41 #include "content/child/background_sync/background_sync_provider.h"
41 #include "content/child/background_sync/background_sync_provider_thread_proxy.h" 42 #include "content/child/background_sync/background_sync_provider_thread_proxy.h"
42 #include "content/child/child_thread_impl.h" 43 #include "content/child/child_thread_impl.h"
43 #include "content/child/content_child_helpers.h" 44 #include "content/child/content_child_helpers.h"
44 #include "content/child/geofencing/web_geofencing_provider_impl.h" 45 #include "content/child/geofencing/web_geofencing_provider_impl.h"
45 #include "content/child/navigator_connect/service_port_provider.h" 46 #include "content/child/navigator_connect/service_port_provider.h"
46 #include "content/child/notifications/notification_dispatcher.h" 47 #include "content/child/notifications/notification_dispatcher.h"
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 472
472 BlinkPlatformImpl::~BlinkPlatformImpl() { 473 BlinkPlatformImpl::~BlinkPlatformImpl() {
473 } 474 }
474 475
475 WebURLLoader* BlinkPlatformImpl::createURLLoader() { 476 WebURLLoader* BlinkPlatformImpl::createURLLoader() {
476 ChildThreadImpl* child_thread = ChildThreadImpl::current(); 477 ChildThreadImpl* child_thread = ChildThreadImpl::current();
477 // There may be no child thread in RenderViewTests. These tests can still use 478 // There may be no child thread in RenderViewTests. These tests can still use
478 // data URLs to bypass the ResourceDispatcher. 479 // data URLs to bypass the ResourceDispatcher.
479 return new WebURLLoaderImpl( 480 return new WebURLLoaderImpl(
480 child_thread ? child_thread->resource_dispatcher() : NULL, 481 child_thread ? child_thread->resource_dispatcher() : NULL,
481 MainTaskRunnerForCurrentThread()); 482 new scheduler::WebTaskRunnerImpl(LoadingTaskRunnerForCurrentThread()));
Sami 2015/09/29 11:22:46 Since LoadingTaskRunnerForCurrentThread is only us
alex clarke (OOO till 29th) 2015/09/29 16:37:38 Done.
482 } 483 }
483 484
484 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { 485 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() {
485 return new WebSocketBridge; 486 return new WebSocketBridge;
486 } 487 }
487 488
488 WebString BlinkPlatformImpl::userAgent() { 489 WebString BlinkPlatformImpl::userAgent() {
489 return WebString::fromUTF8(GetContentClient()->GetUserAgent()); 490 return WebString::fromUTF8(GetContentClient()->GetUserAgent());
490 } 491 }
491 492
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 #endif 1358 #endif
1358 } 1359 }
1359 1360
1360 uint32_t BlinkPlatformImpl::getUniqueIdForProcess() { 1361 uint32_t BlinkPlatformImpl::getUniqueIdForProcess() {
1361 // TODO(rickyz): Replace this with base::GetUniqueIdForProcess when that's 1362 // TODO(rickyz): Replace this with base::GetUniqueIdForProcess when that's
1362 // ready. 1363 // ready.
1363 return base::trace_event::TraceLog::GetInstance()->process_id(); 1364 return base::trace_event::TraceLog::GetInstance()->process_id();
1364 } 1365 }
1365 1366
1366 scoped_refptr<base::SingleThreadTaskRunner> 1367 scoped_refptr<base::SingleThreadTaskRunner>
1367 BlinkPlatformImpl::MainTaskRunnerForCurrentThread() { 1368 BlinkPlatformImpl::LoadingTaskRunnerForCurrentThread() {
Sami 2015/09/29 11:22:46 I think you could replace all of this with base::T
alex clarke (OOO till 29th) 2015/09/29 16:37:38 Done.
1368 if (main_thread_task_runner_.get() && 1369 if (main_thread_task_runner_.get() &&
1369 main_thread_task_runner_->BelongsToCurrentThread()) { 1370 main_thread_task_runner_->BelongsToCurrentThread()) {
1370 return main_thread_task_runner_; 1371 return main_thread_task_runner_;
1371 } else { 1372 } else {
1372 return base::ThreadTaskRunnerHandle::Get(); 1373 return base::ThreadTaskRunnerHandle::Get();
1373 } 1374 }
1374 } 1375 }
1375 1376
1376 bool BlinkPlatformImpl::IsMainThread() const { 1377 bool BlinkPlatformImpl::IsMainThread() const {
1377 return main_thread_task_runner_.get() && 1378 return main_thread_task_runner_.get() &&
(...skipping 14 matching lines...) Expand all
1392 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( 1393 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString(
1393 static_cast<ui::DomKey>(dom_key))); 1394 static_cast<ui::DomKey>(dom_key)));
1394 } 1395 }
1395 1396
1396 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { 1397 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) {
1397 return static_cast<int>( 1398 return static_cast<int>(
1398 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8().data())); 1399 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8().data()));
1399 } 1400 }
1400 1401
1401 } // namespace content 1402 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698