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

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

Issue 2403573002: cc: Introduce mechanism to observe CompositorFrames submitted to new surfaceIDs (Closed)
Patch Set: Updated changes missed 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
« no previous file with comments | « cc/surfaces/surface_damage_observer.h ('k') | cc/surfaces/surface_factory_unittest.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_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();
80 // Tell the SurfaceManager if this is the first frame submitted with this
81 // LocalFrameId.
82 if (!previous_frame.delegated_frame_data) {
83 float device_scale_factor = frame.metadata.device_scale_factor;
84 gfx::Size frame_size;
85 // CompositorFrames may not be populated with a RenderPass in unit tests.
86 if (frame.delegated_frame_data &&
87 !frame.delegated_frame_data->render_pass_list.empty()) {
88 frame_size =
89 frame.delegated_frame_data->render_pass_list[0]->output_rect.size();
90 }
91 manager_->SurfaceCreated(it->second->surface_id(), frame_size,
92 device_scale_factor);
93 }
79 it->second->QueueFrame(std::move(frame), callback); 94 it->second->QueueFrame(std::move(frame), callback);
80 if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) { 95 if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) {
81 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD); 96 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD);
82 it->second->RunDrawCallbacks(); 97 it->second->RunDrawCallbacks();
83 } 98 }
84 } 99 }
85 100
86 void SurfaceFactory::RequestCopyOfSurface( 101 void SurfaceFactory::RequestCopyOfSurface(
87 const LocalFrameId& local_frame_id, 102 const LocalFrameId& local_frame_id,
88 std::unique_ptr<CopyOutputRequest> copy_request) { 103 std::unique_ptr<CopyOutputRequest> copy_request) {
(...skipping 19 matching lines...) Expand all
108 123
109 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { 124 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) {
110 holder_.RefResources(resources); 125 holder_.RefResources(resources);
111 } 126 }
112 127
113 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { 128 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) {
114 holder_.UnrefResources(resources); 129 holder_.UnrefResources(resources);
115 } 130 }
116 131
117 } // namespace cc 132 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_damage_observer.h ('k') | cc/surfaces/surface_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698