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

Unified Diff: content/child/webthread_impl.cc

Issue 869573005: Implement posting location tracking in WebThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make_scoped_ptr 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/webthread_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webthread_impl.cc
diff --git a/content/child/webthread_impl.cc b/content/child/webthread_impl.cc
index 28d687bd5ad08a697f0969a865ff1a33b84a6d87..4f4f0e8d516e53f34fa264a3063cfeb4cc7b7dc5 100644
--- a/content/child/webthread_impl.cc
+++ b/content/child/webthread_impl.cc
@@ -12,6 +12,7 @@
#include "base/message_loop/message_loop.h"
#include "base/pending_task.h"
#include "base/threading/platform_thread.h"
+#include "third_party/WebKit/public/platform/WebTraceLocation.h"
namespace content {
@@ -88,15 +89,29 @@ static void RunWebThreadTask(scoped_ptr<blink::WebThread::Task> task) {
}
void WebThreadImpl::postTask(Task* task) {
- thread_->message_loop()->PostTask(
- FROM_HERE,
- base::Bind(RunWebThreadTask, base::Passed(scoped_ptr<Task>(task))));
+ postDelayedTask(task, 0);
+}
+
+void WebThreadImpl::postTask(const blink::WebTraceLocation& location,
+ Task* task) {
+ postDelayedTask(location, task, 0);
}
void WebThreadImpl::postDelayedTask(Task* task, long long delay_ms) {
thread_->message_loop()->PostDelayedTask(
FROM_HERE,
- base::Bind(RunWebThreadTask, base::Passed(scoped_ptr<Task>(task))),
+ base::Bind(RunWebThreadTask, base::Passed(make_scoped_ptr(task))),
+ base::TimeDelta::FromMilliseconds(delay_ms));
+}
+
+void WebThreadImpl::postDelayedTask(const blink::WebTraceLocation& web_location,
+ Task* task,
+ long long delay_ms) {
+ tracked_objects::Location location(web_location.functionName(),
+ web_location.fileName(), -1, nullptr);
+ thread_->message_loop()->PostDelayedTask(
+ location,
+ base::Bind(RunWebThreadTask, base::Passed(make_scoped_ptr(task))),
base::TimeDelta::FromMilliseconds(delay_ms));
}
@@ -130,9 +145,13 @@ WebThreadImplForMessageLoop::WebThreadImplForMessageLoop(
thread_id_(base::PlatformThread::CurrentId()) {}
void WebThreadImplForMessageLoop::postTask(Task* task) {
- main_thread_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(RunWebThreadTask, base::Passed(make_scoped_ptr(task))));
+ postDelayedTask(task, 0);
+}
+
+void WebThreadImplForMessageLoop::postTask(
+ const blink::WebTraceLocation& location,
+ Task* task) {
+ postDelayedTask(location, task, 0);
}
void WebThreadImplForMessageLoop::postDelayedTask(Task* task,
@@ -143,6 +162,18 @@ void WebThreadImplForMessageLoop::postDelayedTask(Task* task,
base::TimeDelta::FromMilliseconds(delay_ms));
}
+void WebThreadImplForMessageLoop::postDelayedTask(
+ const blink::WebTraceLocation& web_location,
+ Task* task,
+ long long delay_ms) {
+ tracked_objects::Location location(web_location.functionName(),
+ web_location.fileName(), -1, nullptr);
+ main_thread_task_runner_->PostDelayedTask(
+ location,
+ base::Bind(RunWebThreadTask, base::Passed(make_scoped_ptr(task))),
+ base::TimeDelta::FromMilliseconds(delay_ms));
+}
+
void WebThreadImplForMessageLoop::enterRunLoop() {
CHECK(isCurrentThread());
// We don't support nesting.
« no previous file with comments | « content/child/webthread_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698