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

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

Issue 2403573002: cc: Introduce mechanism to observe CompositorFrames submitted to new surfaceIDs (Closed)
Patch Set: Created 4 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_factory.h" 5 #include "cc/surfaces/surface_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 } 70 }
71 71
72 void SurfaceFactory::SubmitCompositorFrame(const LocalFrameId& local_frame_id, 72 void SurfaceFactory::SubmitCompositorFrame(const LocalFrameId& local_frame_id,
73 CompositorFrame frame, 73 CompositorFrame frame,
74 const DrawCallback& callback) { 74 const DrawCallback& callback) {
75 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); 75 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame");
76 OwningSurfaceMap::iterator it = surface_map_.find(local_frame_id); 76 OwningSurfaceMap::iterator it = surface_map_.find(local_frame_id);
77 DCHECK(it != surface_map_.end()); 77 DCHECK(it != surface_map_.end());
78 DCHECK(it->second->factory().get() == this); 78 DCHECK(it->second->factory().get() == this);
79 const CompositorFrame& previous_frame = it->second->GetEligibleFrame();
vmpstr 2016/10/11 21:59:04 Can you add a comment explaining this logic, pleas
Fady Samuel 2016/10/11 23:11:45 Done.
80 if (!previous_frame.delegated_frame_data) {
81 float device_scale_factor = frame.metadata.device_scale_factor;
82 gfx::Size frame_size;
83 if (frame.delegated_frame_data &&
84 frame.delegated_frame_data->render_pass_list.size() > 0) {
vmpstr 2016/10/11 21:59:04 nit: !frame.delegated_frame_data->render_pass_list
Fady Samuel 2016/10/11 23:11:45 Done.
85 frame_size =
86 frame.delegated_frame_data->render_pass_list[0]->output_rect.size();
87 }
88 manager_->SurfaceCreated(it->second->surface_id(), frame_size,
89 device_scale_factor);
90 }
79 it->second->QueueFrame(std::move(frame), callback); 91 it->second->QueueFrame(std::move(frame), callback);
80 if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) { 92 if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) {
81 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD); 93 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD);
82 it->second->RunDrawCallbacks(); 94 it->second->RunDrawCallbacks();
83 } 95 }
84 } 96 }
85 97
86 void SurfaceFactory::RequestCopyOfSurface( 98 void SurfaceFactory::RequestCopyOfSurface(
87 const LocalFrameId& local_frame_id, 99 const LocalFrameId& local_frame_id,
88 std::unique_ptr<CopyOutputRequest> copy_request) { 100 std::unique_ptr<CopyOutputRequest> copy_request) {
(...skipping 19 matching lines...) Expand all
108 120
109 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { 121 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) {
110 holder_.RefResources(resources); 122 holder_.RefResources(resources);
111 } 123 }
112 124
113 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { 125 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) {
114 holder_.UnrefResources(resources); 126 holder_.UnrefResources(resources);
115 } 127 }
116 128
117 } // namespace cc 129 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698