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

Side by Side Diff: components/mus/public/cpp/lib/output_surface.cc

Issue 2096493002: Make cc::CompositorFrames movable [Part 1 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dana's nits Created 4 years, 5 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/trees/layer_tree_host_unittest.cc ('k') | components/mus/public/cpp/output_surface.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/mus/public/cpp/output_surface.h" 5 #include "components/mus/public/cpp/output_surface.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_ack.h" 9 #include "cc/output/compositor_frame_ack.h"
10 #include "cc/output/output_surface_client.h" 10 #include "cc/output/output_surface_client.h"
(...skipping 27 matching lines...) Expand all
38 // This is a delegating output surface, no framebuffer/direct drawing support. 38 // This is a delegating output surface, no framebuffer/direct drawing support.
39 NOTREACHED(); 39 NOTREACHED();
40 } 40 }
41 41
42 uint32_t OutputSurface::GetFramebufferCopyTextureFormat() { 42 uint32_t OutputSurface::GetFramebufferCopyTextureFormat() {
43 // This is a delegating output surface, no framebuffer/direct drawing support. 43 // This is a delegating output surface, no framebuffer/direct drawing support.
44 NOTREACHED(); 44 NOTREACHED();
45 return 0; 45 return 0;
46 } 46 }
47 47
48 void OutputSurface::SwapBuffers(cc::CompositorFrame* frame) { 48 void OutputSurface::SwapBuffers(cc::CompositorFrame frame) {
49 // TODO(fsamuel, rjkroege): We should probably throttle compositor frames. 49 // TODO(fsamuel, rjkroege): We should probably throttle compositor frames.
50 client_->DidSwapBuffers(); 50 client_->DidSwapBuffers();
51 // OutputSurface owns WindowSurface, and so if OutputSurface is 51 // OutputSurface owns WindowSurface, and so if OutputSurface is
52 // destroyed then SubmitCompositorFrame's callback will never get called. 52 // destroyed then SubmitCompositorFrame's callback will never get called.
53 // Thus, base::Unretained is safe here. 53 // Thus, base::Unretained is safe here.
54 surface_->SubmitCompositorFrame( 54 surface_->SubmitCompositorFrame(
55 cc::mojom::CompositorFrame::From(*frame), 55 cc::mojom::CompositorFrame::From(frame),
56 base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); 56 base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this)));
57 } 57 }
58 58
59 void OutputSurface::OnResourcesReturned( 59 void OutputSurface::OnResourcesReturned(
60 mus::WindowSurface* surface, 60 mus::WindowSurface* surface,
61 mojo::Array<cc::ReturnedResource> resources) { 61 mojo::Array<cc::ReturnedResource> resources) {
62 cc::CompositorFrameAck cfa; 62 cc::CompositorFrameAck cfa;
63 cfa.resources = resources.To<cc::ReturnedResourceArray>(); 63 cfa.resources = resources.To<cc::ReturnedResourceArray>();
64 ReclaimResources(&cfa); 64 ReclaimResources(&cfa);
65 } 65 }
66 66
67 void OutputSurface::SwapBuffersComplete() { 67 void OutputSurface::SwapBuffersComplete() {
68 client_->DidSwapBuffersComplete(); 68 client_->DidSwapBuffersComplete();
69 } 69 }
70 70
71 } // namespace mus 71 } // namespace mus
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | components/mus/public/cpp/output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698