OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/test/fake_compositor_frame_sink.h" | 5 #include "cc/test/fake_compositor_frame_sink.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
9 #include "cc/output/compositor_frame_sink_client.h" | 9 #include "cc/output/compositor_frame_sink_client.h" |
10 #include "cc/resources/returned_resource.h" | 10 #include "cc/resources/returned_resource.h" |
11 #include "cc/test/begin_frame_args_test.h" | 11 #include "cc/test/begin_frame_args_test.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 FakeCompositorFrameSink::FakeCompositorFrameSink( | 16 FakeCompositorFrameSink::FakeCompositorFrameSink( |
17 scoped_refptr<ContextProvider> context_provider, | 17 scoped_refptr<ContextProvider> context_provider, |
18 scoped_refptr<ContextProvider> worker_context_provider) | 18 scoped_refptr<ContextProvider> worker_context_provider) |
19 : CompositorFrameSink(std::move(context_provider), | 19 : CompositorFrameSink(std::move(context_provider), |
20 std::move(worker_context_provider)), | 20 std::move(worker_context_provider), |
21 weak_ptr_factory_(this) {} | 21 nullptr, |
| 22 nullptr), |
| 23 weak_ptr_factory_(this) { |
| 24 gpu_memory_buffer_manager_ = |
| 25 context_provider_ ? &test_gpu_memory_buffer_manager_ : nullptr; |
| 26 shared_bitmap_manager_ = |
| 27 context_provider_ ? nullptr : &test_shared_bitmap_manager_; |
| 28 } |
22 | 29 |
23 FakeCompositorFrameSink::~FakeCompositorFrameSink() = default; | 30 FakeCompositorFrameSink::~FakeCompositorFrameSink() = default; |
24 | 31 |
25 void FakeCompositorFrameSink::DetachFromClient() { | 32 void FakeCompositorFrameSink::DetachFromClient() { |
26 ReturnResourcesHeldByParent(); | 33 ReturnResourcesHeldByParent(); |
27 CompositorFrameSink::DetachFromClient(); | 34 CompositorFrameSink::DetachFromClient(); |
28 } | 35 } |
29 | 36 |
30 void FakeCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { | 37 void FakeCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { |
31 ReturnResourcesHeldByParent(); | 38 ReturnResourcesHeldByParent(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // Return the last frame's resources immediately. | 75 // Return the last frame's resources immediately. |
69 ReturnedResourceArray resources; | 76 ReturnedResourceArray resources; |
70 for (const auto& resource : resources_held_by_parent_) | 77 for (const auto& resource : resources_held_by_parent_) |
71 resources.push_back(resource.ToReturnedResource()); | 78 resources.push_back(resource.ToReturnedResource()); |
72 resources_held_by_parent_.clear(); | 79 resources_held_by_parent_.clear(); |
73 client_->ReclaimResources(resources); | 80 client_->ReclaimResources(resources); |
74 } | 81 } |
75 } | 82 } |
76 | 83 |
77 } // namespace cc | 84 } // namespace cc |
OLD | NEW |