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

Side by Side Diff: cc/output/context_cache_controller.cc

Issue 2286873003: Provide TaskRunner to ContextCacheController (Closed)
Patch Set: cleanup Created 4 years, 3 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 (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/output/context_cache_controller.h" 5 #include "cc/output/context_cache_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/single_thread_task_runner.h"
9 #include "gpu/command_buffer/client/context_support.h" 10 #include "gpu/command_buffer/client/context_support.h"
10 #include "third_party/skia/include/gpu/GrContext.h" 11 #include "third_party/skia/include/gpu/GrContext.h"
11 12
12 namespace cc { 13 namespace cc {
13 ContextCacheController::ScopedVisibility::ScopedVisibility() = default; 14 ContextCacheController::ScopedVisibility::ScopedVisibility() = default;
14 15
15 ContextCacheController::ScopedVisibility::~ScopedVisibility() { 16 ContextCacheController::ScopedVisibility::~ScopedVisibility() {
16 DCHECK(released_); 17 DCHECK(released_);
17 } 18 }
18 19
19 void ContextCacheController::ScopedVisibility::Release() { 20 void ContextCacheController::ScopedVisibility::Release() {
20 DCHECK(!released_); 21 DCHECK(!released_);
21 released_ = true; 22 released_ = true;
22 } 23 }
23 24
24 ContextCacheController::ContextCacheController( 25 ContextCacheController::ContextCacheController(
25 gpu::ContextSupport* context_support) 26 gpu::ContextSupport* context_support,
26 : context_support_(context_support) {} 27 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
28 : context_support_(context_support), task_runner_(std::move(task_runner)) {}
27 29
28 ContextCacheController::~ContextCacheController() = default; 30 ContextCacheController::~ContextCacheController() = default;
29 31
30 void ContextCacheController::SetGrContext(GrContext* gr_context) { 32 void ContextCacheController::SetGrContext(GrContext* gr_context) {
31 gr_context_ = gr_context; 33 gr_context_ = gr_context;
32 } 34 }
33 35
34 std::unique_ptr<ContextCacheController::ScopedVisibility> 36 std::unique_ptr<ContextCacheController::ScopedVisibility>
35 ContextCacheController::ClientBecameVisible() { 37 ContextCacheController::ClientBecameVisible() {
36 bool became_visible = num_clients_visible_ == 0; 38 bool became_visible = num_clients_visible_ == 0;
(...skipping 24 matching lines...) Expand all
61 ContextCacheController::CreateScopedVisibilityForTesting() const { 63 ContextCacheController::CreateScopedVisibilityForTesting() const {
62 return base::WrapUnique(new ScopedVisibility()); 64 return base::WrapUnique(new ScopedVisibility());
63 } 65 }
64 66
65 void ContextCacheController::ReleaseScopedVisibilityForTesting( 67 void ContextCacheController::ReleaseScopedVisibilityForTesting(
66 std::unique_ptr<ScopedVisibility> scoped_visibility) const { 68 std::unique_ptr<ScopedVisibility> scoped_visibility) const {
67 scoped_visibility->Release(); 69 scoped_visibility->Release();
68 } 70 }
69 71
70 } // namespace cc 72 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698