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

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/Resource.cpp

Issue 2878343002: Use LoadingTaskRunner for cancel_timer_ of Resource class (Closed)
Patch Set: add comment Created 3 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/loader/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp b/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp
index c874c0774d0fe3f576d001693dc6f832285fbfa3..d67a8fa1369e9874d0684ad3c72e16addd95277e 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp
@@ -269,14 +269,19 @@ Resource::Resource(const ResourceRequest& request,
integrity_disposition_(ResourceIntegrityDisposition::kNotChecked),
options_(options),
response_timestamp_(CurrentTime()),
- cancel_timer_(IsMainThread()
- ? Platform::Current()->MainThread()->GetWebTaskRunner()
- : Platform::Current()
- ->CurrentThread()
- ->Scheduler()
- ->LoadingTaskRunner(),
- this,
- &Resource::CancelTimerFired),
+ cancel_timer_(
+ // We use MainThread() for main-thread cases to avoid syscall cost
+ // when checking main_thread_->isCurrentThread() in currentThread().
+ IsMainThread() ? Platform::Current()
+ ->MainThread()
+ ->Scheduler()
+ ->LoadingTaskRunner()
+ : Platform::Current()
+ ->CurrentThread()
+ ->Scheduler()
+ ->LoadingTaskRunner(),
+ this,
+ &Resource::CancelTimerFired),
resource_request_(request) {
InstanceCounters::IncrementCounter(InstanceCounters::kResourceCounter);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698