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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
7 rights reserved. 7 rights reserved.
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 type_(type), 262 type_(type),
263 status_(ResourceStatus::kNotStarted), 263 status_(ResourceStatus::kNotStarted),
264 needs_synchronous_cache_hit_(false), 264 needs_synchronous_cache_hit_(false),
265 link_preload_(false), 265 link_preload_(false),
266 is_revalidating_(false), 266 is_revalidating_(false),
267 is_alive_(false), 267 is_alive_(false),
268 is_add_remove_client_prohibited_(false), 268 is_add_remove_client_prohibited_(false),
269 integrity_disposition_(ResourceIntegrityDisposition::kNotChecked), 269 integrity_disposition_(ResourceIntegrityDisposition::kNotChecked),
270 options_(options), 270 options_(options),
271 response_timestamp_(CurrentTime()), 271 response_timestamp_(CurrentTime()),
272 cancel_timer_(IsMainThread() 272 cancel_timer_(
273 ? Platform::Current()->MainThread()->GetWebTaskRunner() 273 // We use MainThread() for main-thread cases to avoid syscall cost
274 : Platform::Current() 274 // when checking main_thread_->isCurrentThread() in currentThread().
275 ->CurrentThread() 275 IsMainThread() ? Platform::Current()
276 ->Scheduler() 276 ->MainThread()
277 ->LoadingTaskRunner(), 277 ->Scheduler()
278 this, 278 ->LoadingTaskRunner()
279 &Resource::CancelTimerFired), 279 : Platform::Current()
280 ->CurrentThread()
281 ->Scheduler()
282 ->LoadingTaskRunner(),
283 this,
284 &Resource::CancelTimerFired),
280 resource_request_(request) { 285 resource_request_(request) {
281 InstanceCounters::IncrementCounter(InstanceCounters::kResourceCounter); 286 InstanceCounters::IncrementCounter(InstanceCounters::kResourceCounter);
282 287
283 // Currently we support the metadata caching only for HTTP family. 288 // Currently we support the metadata caching only for HTTP family.
284 if (GetResourceRequest().Url().ProtocolIsInHTTPFamily()) 289 if (GetResourceRequest().Url().ProtocolIsInHTTPFamily())
285 cache_handler_ = CachedMetadataHandlerImpl::Create(this); 290 cache_handler_ = CachedMetadataHandlerImpl::Create(this);
286 if (IsMainThread()) 291 if (IsMainThread())
287 MemoryCoordinator::Instance().RegisterClient(this); 292 MemoryCoordinator::Instance().RegisterClient(this);
288 } 293 }
289 294
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 case Resource::kMedia: 1084 case Resource::kMedia:
1080 case Resource::kManifest: 1085 case Resource::kManifest:
1081 case Resource::kMock: 1086 case Resource::kMock:
1082 return false; 1087 return false;
1083 } 1088 }
1084 NOTREACHED(); 1089 NOTREACHED();
1085 return false; 1090 return false;
1086 } 1091 }
1087 1092
1088 } // namespace blink 1093 } // namespace blink
OLDNEW
« 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