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

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

Issue 553213003: Avoid destroying surface before the parent surface stops referencing it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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/output/copy_output_request.h" 8 #include "cc/output/copy_output_request.h"
9 #include "cc/surfaces/surface_factory.h" 9 #include "cc/surfaces/surface_factory.h"
10 #include "cc/surfaces/surface_manager.h"
10 11
11 namespace cc { 12 namespace cc {
12 13
13 // The frame index starts at 2 so that empty frames will be treated as 14 // The frame index starts at 2 so that empty frames will be treated as
14 // completely damaged the first time they're drawn from. 15 // completely damaged the first time they're drawn from.
15 static const int kFrameIndexStart = 2; 16 static const int kFrameIndexStart = 2;
16 17
17 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory) 18 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory)
18 : surface_id_(id), 19 : surface_id_(id),
19 size_(size), 20 size_(size),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (previous_frame) { 57 if (previous_frame) {
57 ReturnedResourceArray previous_resources; 58 ReturnedResourceArray previous_resources;
58 TransferableResource::ReturnResources( 59 TransferableResource::ReturnResources(
59 previous_frame->delegated_frame_data->resource_list, 60 previous_frame->delegated_frame_data->resource_list,
60 &previous_resources); 61 &previous_resources);
61 factory_->UnrefResources(previous_resources); 62 factory_->UnrefResources(previous_resources);
62 } 63 }
63 if (!draw_callback_.is_null()) 64 if (!draw_callback_.is_null())
64 draw_callback_.Run(); 65 draw_callback_.Run();
65 draw_callback_ = callback; 66 draw_callback_ = callback;
67 factory_->manager()->DidSatisfySequences(
68 surface_id_, &current_frame_->metadata.satisfies_sequences);
66 } 69 }
67 70
68 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { 71 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) {
69 copy_requests_.push_back(copy_request.Pass()); 72 copy_requests_.push_back(copy_request.Pass());
70 } 73 }
71 74
72 void Surface::TakeCopyOutputRequests( 75 void Surface::TakeCopyOutputRequests(
73 ScopedPtrVector<CopyOutputRequest>* copy_requests) { 76 ScopedPtrVector<CopyOutputRequest>* copy_requests) {
74 DCHECK(copy_requests->empty()); 77 DCHECK(copy_requests->empty());
75 copy_requests->swap(copy_requests_); 78 copy_requests->swap(copy_requests_);
(...skipping 18 matching lines...) Expand all
94 97
95 void Surface::RunDrawCallbacks() { 98 void Surface::RunDrawCallbacks() {
96 if (!draw_callback_.is_null()) { 99 if (!draw_callback_.is_null()) {
97 base::Closure callback = draw_callback_; 100 base::Closure callback = draw_callback_;
98 draw_callback_ = base::Closure(); 101 draw_callback_ = base::Closure();
99 callback.Run(); 102 callback.Run();
100 } 103 }
101 } 104 }
102 105
103 } // namespace cc 106 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698