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

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

Issue 2752833002: cc: Use gpu raster in HUD. (Closed)
Patch Set: create new surface for each tex Created 3 years, 8 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_provider.h" 5 #include "cc/output/context_provider.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 ContextProvider::ScopedContextLock::ScopedContextLock( 9 ContextProvider::ScopedContextLock::ScopedContextLock(
10 ContextProvider* context_provider) 10 ContextProvider* context_provider)
11 : context_provider_(context_provider), 11 : context_provider_(context_provider),
12 context_lock_(*context_provider_->GetLock()) { 12 context_lock_(*context_provider_->GetLock()) {
13 // Allow current thread to use |context_provider_|. 13 // Allow current thread to use |context_provider_|.
14 context_provider_->DetachFromThread(); 14 context_provider_->DetachFromThread();
15 busy_ = context_provider_->CacheController()->ClientBecameBusy(); 15 busy_ = context_provider_->CacheController()->ClientBecameBusy();
16 } 16 }
17 17
18 ContextProvider::ScopedContextLock::~ScopedContextLock() { 18 ContextProvider::ScopedContextLock::~ScopedContextLock() {
19 // Let ContextCacheController know we are no longer busy. 19 // Let ContextCacheController know we are no longer busy.
20 context_provider_->CacheController()->ClientBecameNotBusy(std::move(busy_)); 20 context_provider_->CacheController()->ClientBecameNotBusy(std::move(busy_));
21 21
22 // Allow usage by thread for which |context_provider_| is bound to. 22 // Allow usage by thread for which |context_provider_| is bound to.
23 context_provider_->DetachFromThread(); 23 context_provider_->DetachFromThread();
24 } 24 }
25 25
26 ContextProvider::ScopedContext::ScopedContext(ContextProvider* context_provider)
27 : context_provider_(context_provider) {
28 // Allow current thread to use |context_provider_|.
29 context_provider_->DetachFromThread();
30 busy_ = context_provider_->CacheController()->ClientBecameBusy();
31 }
32
33 ContextProvider::ScopedContext::~ScopedContext() {
34 // Let ContextCacheController know we are no longer busy.
35 context_provider_->CacheController()->ClientBecameNotBusy(std::move(busy_));
36
37 // Allow usage by thread for which |context_provider_| is bound to.
38 context_provider_->DetachFromThread();
39 }
40
26 } // namespace cc 41 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698