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

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

Issue 511423004: Add LatencyInfo support for Surfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/surfaces/surface.h ('k') | cc/surfaces/surface_aggregator.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 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 10
(...skipping 15 matching lines...) Expand all
26 ReturnedResourceArray current_resources; 26 ReturnedResourceArray current_resources;
27 TransferableResource::ReturnResources( 27 TransferableResource::ReturnResources(
28 current_frame_->delegated_frame_data->resource_list, 28 current_frame_->delegated_frame_data->resource_list,
29 &current_resources); 29 &current_resources);
30 factory_->UnrefResources(current_resources); 30 factory_->UnrefResources(current_resources);
31 } 31 }
32 } 32 }
33 33
34 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, 34 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame,
35 const base::Closure& callback) { 35 const base::Closure& callback) {
36 TakeLatencyInfo(&frame->metadata.latency_info);
36 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass(); 37 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass();
37 current_frame_ = frame.Pass(); 38 current_frame_ = frame.Pass();
38 factory_->ReceiveFromChild( 39 factory_->ReceiveFromChild(
39 current_frame_->delegated_frame_data->resource_list); 40 current_frame_->delegated_frame_data->resource_list);
40 ++frame_index_; 41 ++frame_index_;
41 42
42 if (previous_frame) { 43 if (previous_frame) {
43 ReturnedResourceArray previous_resources; 44 ReturnedResourceArray previous_resources;
44 TransferableResource::ReturnResources( 45 TransferableResource::ReturnResources(
45 previous_frame->delegated_frame_data->resource_list, 46 previous_frame->delegated_frame_data->resource_list,
46 &previous_resources); 47 &previous_resources);
47 factory_->UnrefResources(previous_resources); 48 factory_->UnrefResources(previous_resources);
48 } 49 }
49 if (!draw_callback_.is_null()) 50 if (!draw_callback_.is_null())
50 draw_callback_.Run(); 51 draw_callback_.Run();
51 draw_callback_ = callback; 52 draw_callback_ = callback;
52 } 53 }
53 54
54 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { 55 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) {
55 // TODO(jbauman): Make this work. 56 // TODO(jbauman): Make this work.
56 copy_request->SendEmptyResult(); 57 copy_request->SendEmptyResult();
57 } 58 }
58 59
59 const CompositorFrame* Surface::GetEligibleFrame() { 60 const CompositorFrame* Surface::GetEligibleFrame() {
60 return current_frame_.get(); 61 return current_frame_.get();
61 } 62 }
62 63
64 void Surface::TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info) {
65 if (!current_frame_)
66 return;
67 if (latency_info->empty()) {
68 current_frame_->metadata.latency_info.swap(*latency_info);
69 return;
70 }
71 std::copy(current_frame_->metadata.latency_info.begin(),
72 current_frame_->metadata.latency_info.end(),
73 std::back_inserter(*latency_info));
74 current_frame_->metadata.latency_info.clear();
75 }
76
63 void Surface::RunDrawCallbacks() { 77 void Surface::RunDrawCallbacks() {
64 if (!draw_callback_.is_null()) { 78 if (!draw_callback_.is_null()) {
65 base::Closure callback = draw_callback_; 79 base::Closure callback = draw_callback_;
66 draw_callback_ = base::Closure(); 80 draw_callback_ = base::Closure();
67 callback.Run(); 81 callback.Run();
68 } 82 }
69 } 83 }
70 84
71 } // namespace cc 85 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_aggregator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698