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

Side by Side Diff: cc/test/fake_output_surface.cc

Issue 2402173002: cc: Get rid of PostSwapBuffersComplete. (Closed)
Patch Set: postswap: fix-blimp-unittest-post-swap-acks Created 4 years, 2 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
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_output_surface.h" 5 #include "cc/test/fake_output_surface.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "cc/output/output_surface_client.h" 9 #include "cc/output/output_surface_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 FakeOutputSurface::FakeOutputSurface( 16 FakeOutputSurface::FakeOutputSurface(
17 scoped_refptr<ContextProvider> context_provider) 17 scoped_refptr<ContextProvider> context_provider)
18 : OutputSurface(std::move(context_provider)) { 18 : OutputSurface(std::move(context_provider)), weak_ptr_factory_(this) {
19 DCHECK(OutputSurface::context_provider()); 19 DCHECK(OutputSurface::context_provider());
20 } 20 }
21 21
22 FakeOutputSurface::FakeOutputSurface( 22 FakeOutputSurface::FakeOutputSurface(
23 std::unique_ptr<SoftwareOutputDevice> software_device) 23 std::unique_ptr<SoftwareOutputDevice> software_device)
24 : OutputSurface(std::move(software_device)) { 24 : OutputSurface(std::move(software_device)), weak_ptr_factory_(this) {
25 DCHECK(OutputSurface::software_device()); 25 DCHECK(OutputSurface::software_device());
26 } 26 }
27 27
28 FakeOutputSurface::~FakeOutputSurface() = default; 28 FakeOutputSurface::~FakeOutputSurface() = default;
29 29
30 void FakeOutputSurface::Reshape(const gfx::Size& size, 30 void FakeOutputSurface::Reshape(const gfx::Size& size,
31 float device_scale_factor, 31 float device_scale_factor,
32 const gfx::ColorSpace& color_space, 32 const gfx::ColorSpace& color_space,
33 bool has_alpha) { 33 bool has_alpha) {
34 if (context_provider()) { 34 if (context_provider()) {
(...skipping 10 matching lines...) Expand all
45 45
46 if (context_provider()) { 46 if (context_provider()) {
47 last_swap_rect_ = last_sent_frame_->sub_buffer_rect; 47 last_swap_rect_ = last_sent_frame_->sub_buffer_rect;
48 last_swap_rect_valid_ = true; 48 last_swap_rect_valid_ = true;
49 } else { 49 } else {
50 // Unknown for direct software frames. 50 // Unknown for direct software frames.
51 last_swap_rect_ = gfx::Rect(); 51 last_swap_rect_ = gfx::Rect();
52 last_swap_rect_valid_ = false; 52 last_swap_rect_valid_ = false;
53 } 53 }
54 54
55 PostSwapBuffersComplete(); 55 base::ThreadTaskRunnerHandle::Get()->PostTask(
56 FROM_HERE, base::Bind(&FakeOutputSurface::SwapBuffersCallback,
57 weak_ptr_factory_.GetWeakPtr()));
58 }
59
60 void FakeOutputSurface::SwapBuffersCallback() {
61 client_->DidSwapBuffersComplete();
56 } 62 }
57 63
58 void FakeOutputSurface::BindFramebuffer() { 64 void FakeOutputSurface::BindFramebuffer() {
59 context_provider_->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, framebuffer_); 65 context_provider_->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, framebuffer_);
60 } 66 }
61 67
62 uint32_t FakeOutputSurface::GetFramebufferCopyTextureFormat() { 68 uint32_t FakeOutputSurface::GetFramebufferCopyTextureFormat() {
63 if (framebuffer_) 69 if (framebuffer_)
64 return framebuffer_format_; 70 return framebuffer_format_;
65 else 71 else
(...skipping 24 matching lines...) Expand all
90 96
91 bool FakeOutputSurface::IsDisplayedAsOverlayPlane() const { 97 bool FakeOutputSurface::IsDisplayedAsOverlayPlane() const {
92 return false; 98 return false;
93 } 99 }
94 100
95 unsigned FakeOutputSurface::GetOverlayTextureId() const { 101 unsigned FakeOutputSurface::GetOverlayTextureId() const {
96 return 0; 102 return 0;
97 } 103 }
98 104
99 } // namespace cc 105 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698