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

Side by Side Diff: cc/scheduler/rate_limiter.cc

Issue 17114008: cc: Remove cc::Thread and cc::ThreadImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm-thread: NULLrefptrs Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/scheduler/rate_limiter.h ('k') | cc/scheduler/scheduler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/scheduler/rate_limiter.h" 5 #include "cc/scheduler/rate_limiter.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/base/thread.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
9 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 10 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
10 11
11 namespace cc { 12 namespace cc {
12 13
13 scoped_refptr<RateLimiter> RateLimiter::Create( 14 scoped_refptr<RateLimiter> RateLimiter::Create(
14 WebKit::WebGraphicsContext3D* context, 15 WebKit::WebGraphicsContext3D* context,
15 RateLimiterClient* client, 16 RateLimiterClient* client,
16 Thread* thread) { 17 base::SingleThreadTaskRunner* task_runner) {
17 return make_scoped_refptr(new RateLimiter(context, client, thread)); 18 return make_scoped_refptr(new RateLimiter(context, client, task_runner));
18 } 19 }
19 20
20 RateLimiter::RateLimiter(WebKit::WebGraphicsContext3D* context, 21 RateLimiter::RateLimiter(WebKit::WebGraphicsContext3D* context,
21 RateLimiterClient* client, 22 RateLimiterClient* client,
22 Thread* thread) 23 base::SingleThreadTaskRunner* task_runner)
23 : context_(context), 24 : context_(context),
24 active_(false), 25 active_(false),
25 client_(client), 26 client_(client),
26 thread_(thread) { 27 task_runner_(task_runner) {
27 DCHECK(context); 28 DCHECK(context);
28 } 29 }
29 30
30 RateLimiter::~RateLimiter() {} 31 RateLimiter::~RateLimiter() {}
31 32
32 void RateLimiter::Start() { 33 void RateLimiter::Start() {
33 if (active_) 34 if (active_)
34 return; 35 return;
35 36
36 TRACE_EVENT0("cc", "RateLimiter::Start"); 37 TRACE_EVENT0("cc", "RateLimiter::Start");
37 active_ = true; 38 active_ = true;
38 thread_->PostTask(base::Bind(&RateLimiter::RateLimitContext, this)); 39 task_runner_->PostTask(FROM_HERE,
40 base::Bind(&RateLimiter::RateLimitContext, this));
39 } 41 }
40 42
41 void RateLimiter::Stop() { 43 void RateLimiter::Stop() {
42 TRACE_EVENT0("cc", "RateLimiter::Stop"); 44 TRACE_EVENT0("cc", "RateLimiter::Stop");
43 client_ = NULL; 45 client_ = NULL;
44 } 46 }
45 47
46 void RateLimiter::RateLimitContext() { 48 void RateLimiter::RateLimitContext() {
47 if (!client_) 49 if (!client_)
48 return; 50 return;
49 51
50 TRACE_EVENT0("cc", "RateLimiter::RateLimitContext"); 52 TRACE_EVENT0("cc", "RateLimiter::RateLimitContext");
51 53
52 active_ = false; 54 active_ = false;
53 client_->RateLimit(); 55 client_->RateLimit();
54 context_->rateLimitOffscreenContextCHROMIUM(); 56 context_->rateLimitOffscreenContextCHROMIUM();
55 } 57 }
56 58
57 } // namespace cc 59 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/rate_limiter.h ('k') | cc/scheduler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698