Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "cc/output/context_provider.h" | |
| 6 | |
| 7 namespace cc { | |
| 8 | |
| 9 ContextProvider::ScopedContextLock::ScopedContextLock( | |
| 10 ContextProvider* context_provider) | |
| 11 : context_provider_(context_provider), | |
| 12 context_lock_(*context_provider_->GetLock()), | |
| 13 busy_(context_provider_->ContextSupport()->ClientBecameBusy()) { | |
| 14 // Allow current thread to use |context_provider_|. | |
| 15 context_provider_->DetachFromThread(); | |
|
danakj
2016/08/23 01:26:24
You don't need to do this before ClientBecameBusy?
ericrk
2016/08/24 18:32:21
The detach/attach is only necessary before access
| |
| 16 } | |
| 17 | |
| 18 ContextProvider::ScopedContextLock::~ScopedContextLock() { | |
| 19 // Let ContextSupport know we are no longer busy. | |
| 20 context_provider_->ContextSupport()->ClientBecameNotBusy(std::move(busy_)); | |
| 21 | |
| 22 // Allow usage by thread for which |context_provider_| is bound to. | |
| 23 context_provider_->DetachFromThread(); | |
| 24 } | |
| 25 | |
| 26 } // namespace cc | |
| OLD | NEW |