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

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

Issue 432093003: Enqueuing new frames in a Surface should cause Displays to reaggregate it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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.h" 5 #include "cc/surfaces/surface.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/surfaces/display.h"
8 #include "cc/surfaces/surface_factory.h" 9 #include "cc/surfaces/surface_factory.h"
9 10
10 namespace cc { 11 namespace cc {
11 12
12 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory) 13 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory)
13 : surface_id_(id), size_(size), factory_(factory) { 14 : surface_id_(id), size_(size), factory_(factory) {
14 } 15 }
15 16
16 Surface::~Surface() { 17 Surface::~Surface() {
18 for (std::set<Display*>::iterator it = containing_displays_.begin();
jamesr 2014/08/07 21:04:06 if you used IDs then you wouldn't need to do this
19 it != containing_displays_.end();
20 ++it) {
21 (*it)->contained_surfaces().erase(this);
22 }
17 if (current_frame_) { 23 if (current_frame_) {
18 ReturnedResourceArray current_resources; 24 ReturnedResourceArray current_resources;
19 TransferableResource::ReturnResources( 25 TransferableResource::ReturnResources(
20 current_frame_->delegated_frame_data->resource_list, 26 current_frame_->delegated_frame_data->resource_list,
21 &current_resources); 27 &current_resources);
22 factory_->UnrefResources(current_resources); 28 factory_->UnrefResources(current_resources);
23 } 29 }
24 } 30 }
25 31
26 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame) { 32 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame) {
27 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass(); 33 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass();
28 current_frame_ = frame.Pass(); 34 current_frame_ = frame.Pass();
29 factory_->ReceiveFromChild( 35 factory_->ReceiveFromChild(
30 current_frame_->delegated_frame_data->resource_list); 36 current_frame_->delegated_frame_data->resource_list);
31 37
32 if (previous_frame) { 38 if (previous_frame) {
33 ReturnedResourceArray previous_resources; 39 ReturnedResourceArray previous_resources;
34 TransferableResource::ReturnResources( 40 TransferableResource::ReturnResources(
35 previous_frame->delegated_frame_data->resource_list, 41 previous_frame->delegated_frame_data->resource_list,
36 &previous_resources); 42 &previous_resources);
37 factory_->UnrefResources(previous_resources); 43 factory_->UnrefResources(previous_resources);
38 } 44 }
45 for (std::set<Display*>::iterator it = containing_displays_.begin();
46 it != containing_displays_.end();
47 ++it) {
48 (*it)->Draw();
jamesr 2014/08/07 21:04:06 i think the service should be keeping track of thi
49 }
39 } 50 }
40 51
41 const CompositorFrame* Surface::GetEligibleFrame() { 52 const CompositorFrame* Surface::GetEligibleFrame() {
42 return current_frame_.get(); 53 return current_frame_.get();
43 } 54 }
44 55
45 } // namespace cc 56 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698