| Index: cc/test/test_context_support.cc
|
| diff --git a/cc/test/test_context_support.cc b/cc/test/test_context_support.cc
|
| index d3ec892fc5b48ad7ffe76a5044064de916039031..5153dcdf99d21caa4a1b0f3c09dc2b90dbe92b68 100644
|
| --- a/cc/test/test_context_support.cc
|
| +++ b/cc/test/test_context_support.cc
|
| @@ -17,11 +17,13 @@ namespace cc {
|
| namespace {
|
|
|
| // Class that DCHECKs if it is destructed without first having Release called.
|
| -class ScopedVisibilityImpl : public gpu::ContextSupport::ScopedVisibility {
|
| +template <typename T>
|
| +class ScopedContextSupportToken : public T {
|
| public:
|
| - explicit ScopedVisibilityImpl(gpu::ContextSupport* context_support)
|
| + explicit ScopedContextSupportToken(gpu::ContextSupport* context_support)
|
| : initial_context_support_(context_support) {}
|
| - ~ScopedVisibilityImpl() { DCHECK(!initial_context_support_); }
|
| +
|
| + ~ScopedContextSupportToken() { DCHECK(!initial_context_support_); }
|
|
|
| void Release(gpu::ContextSupport* context_support) {
|
| DCHECK_EQ(initial_context_support_, context_support);
|
| @@ -32,6 +34,11 @@ class ScopedVisibilityImpl : public gpu::ContextSupport::ScopedVisibility {
|
| const gpu::ContextSupport* initial_context_support_;
|
| };
|
|
|
| +using ScopedVisibilityImpl =
|
| + ScopedContextSupportToken<gpu::ContextSupport::ScopedVisibility>;
|
| +using ScopedBusyImpl =
|
| + ScopedContextSupportToken<gpu::ContextSupport::ScopedBusy>;
|
| +
|
| } // namespace
|
|
|
| TestContextSupport::TestContextSupport() : weak_ptr_factory_(this) {}
|
| @@ -126,4 +133,15 @@ bool TestContextSupport::AnyClientsVisible() const {
|
| return num_visible_clients_ > 0;
|
| }
|
|
|
| +std::unique_ptr<gpu::ContextSupport::ScopedBusy>
|
| +TestContextSupport::ClientBecameBusy() {
|
| + return base::MakeUnique<ScopedBusyImpl>(this);
|
| +}
|
| +
|
| +void TestContextSupport::ClientBecameNotBusy(std::unique_ptr<ScopedBusy> busy) {
|
| + static_cast<ScopedBusyImpl*>(busy.get())->Release(this);
|
| +}
|
| +
|
| +void TestContextSupport::SetIdleCallback(const base::Closure& callback) {}
|
| +
|
| } // namespace cc
|
|
|