Chromium Code Reviews| Index: cc/test/test_context_support.cc |
| diff --git a/cc/test/test_context_support.cc b/cc/test/test_context_support.cc |
| index 7a47780e4d56369ffc6519477a2c33ff643616f3..8e918c8e8a8e8dc843c08fd6d42ee2198ebc4e6f 100644 |
| --- a/cc/test/test_context_support.cc |
| +++ b/cc/test/test_context_support.cc |
| @@ -9,13 +9,17 @@ |
| #include "base/bind.h" |
| #include "base/location.h" |
| +#include "base/memory/ptr_util.h" |
| #include "base/single_thread_task_runner.h" |
| #include "base/threading/thread_task_runner_handle.h" |
| +#include "gpu/command_buffer/client/scoped_visibility_impl.h" |
| namespace cc { |
| TestContextSupport::TestContextSupport() |
| - : out_of_order_callbacks_(false), weak_ptr_factory_(this) {} |
| + : out_of_order_callbacks_(false), |
| + visible_clients_(0), |
| + weak_ptr_factory_(this) {} |
| TestContextSupport::~TestContextSupport() {} |
| @@ -91,18 +95,22 @@ uint64_t TestContextSupport::ShareGroupTracingGUID() const { |
| void TestContextSupport::SetErrorMessageCallback( |
| const base::Callback<void(const char*, int32_t)>& callback) {} |
| -void TestContextSupport::SetClientVisible(int client_id, bool is_visible) { |
| - if (is_visible) { |
| - visible_clients_.insert(client_id); |
| - } else { |
| - auto found = visible_clients_.find(client_id); |
| - if (found != visible_clients_.end()) |
| - visible_clients_.erase(found); |
| - } |
| +std::unique_ptr<gpu::ContextSupport::ScopedVisibility> |
| +TestContextSupport::ClientBecameVisible() { |
| + ++visible_clients_; |
| + return std::unique_ptr<gpu::ScopedVisibilityImpl>( |
|
danakj
2016/08/18 21:39:44
I think you can just write your own impl here, I d
ericrk
2016/08/19 17:23:19
makes sense, moved to cc file
|
| + new gpu::ScopedVisibilityImpl(this)); |
| +} |
| + |
| +void TestContextSupport::ClientBecameNotVisible( |
| + std::unique_ptr<ScopedVisibility> visibility) { |
| + DCHECK_GT(visible_clients_, 0u); |
| + --visible_clients_; |
| + static_cast<gpu::ScopedVisibilityImpl*>(visibility.get())->Release(this); |
| } |
| bool TestContextSupport::AnyClientsVisible() const { |
| - return !visible_clients_.empty(); |
| + return visible_clients_ > 0; |
| } |
| } // namespace cc |