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

Side by Side Diff: cc/surfaces/surface_display_output_surface.cc

Issue 1073323002: Use null rather than empty frame to lock Surface resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« cc/surfaces/surface.cc ('K') | « cc/surfaces/surface.cc ('k') | no next file » | 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 "cc/surfaces/surface_display_output_surface.h" 5 #include "cc/surfaces/surface_display_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/surfaces/display.h" 10 #include "cc/surfaces/display.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) { 69 bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) {
70 DCHECK(client); 70 DCHECK(client);
71 DCHECK(display_client_); 71 DCHECK(display_client_);
72 client_ = client; 72 client_ = client;
73 // Avoid initializing GL context here, as this should be sharing the 73 // Avoid initializing GL context here, as this should be sharing the
74 // Display's context. 74 // Display's context.
75 return display_client_->Initialize(); 75 return display_client_->Initialize();
76 } 76 }
77 77
78 void SurfaceDisplayOutputSurface::ForceReclaimResources() { 78 void SurfaceDisplayOutputSurface::ForceReclaimResources() {
79 if (!surface_id_.is_null()) { 79 if (!surface_id_.is_null())
80 scoped_ptr<CompositorFrame> empty_frame(new CompositorFrame()); 80 factory_.SubmitFrame(surface_id_, nullptr, SurfaceFactory::DrawCallback());
81 empty_frame->delegated_frame_data.reset(new DelegatedFrameData);
82 factory_.SubmitFrame(surface_id_, empty_frame.Pass(),
83 SurfaceFactory::DrawCallback());
84 }
85 } 81 }
86 82
87 void SurfaceDisplayOutputSurface::ReturnResources( 83 void SurfaceDisplayOutputSurface::ReturnResources(
88 const ReturnedResourceArray& resources) { 84 const ReturnedResourceArray& resources) {
89 CompositorFrameAck ack; 85 CompositorFrameAck ack;
90 ack.resources = resources; 86 ack.resources = resources;
91 if (client_) 87 if (client_)
92 client_->ReclaimResources(&ack); 88 client_->ReclaimResources(&ack);
93 } 89 }
94 90
95 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { 91 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) {
96 if (client_ && !display_client_->output_surface_lost()) 92 if (client_ && !display_client_->output_surface_lost())
97 client_->DidSwapBuffersComplete(); 93 client_->DidSwapBuffersComplete();
98 } 94 }
99 95
100 } // namespace cc 96 } // namespace cc
OLDNEW
« cc/surfaces/surface.cc ('K') | « cc/surfaces/surface.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698