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

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

Issue 2651843002: FrameGenerator should receive SurfaceInfo and use it in frame generation (Closed)
Patch Set: c Created 3 years, 11 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 | « no previous file | 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/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 bool create_new_surface = 60 bool create_new_surface =
61 (!current_surface_ || 61 (!current_surface_ ||
62 local_frame_id != current_surface_->surface_id().local_frame_id()); 62 local_frame_id != current_surface_->surface_id().local_frame_id());
63 if (!create_new_surface) { 63 if (!create_new_surface) {
64 surface = std::move(current_surface_); 64 surface = std::move(current_surface_);
65 } else { 65 } else {
66 surface = Create(local_frame_id); 66 surface = Create(local_frame_id);
67 gfx::Size frame_size; 67 gfx::Size frame_size;
68 // CompositorFrames may not be populated with a RenderPass in unit tests. 68 // CompositorFrames may not be populated with a RenderPass in unit tests.
69 if (!frame.render_pass_list.empty()) 69 if (!frame.render_pass_list.empty())
70 frame_size = frame.render_pass_list[0]->output_rect.size(); 70 frame_size = frame.render_pass_list.back()->output_rect.size();
71 manager_->SurfaceCreated(SurfaceInfo( 71 manager_->SurfaceCreated(SurfaceInfo(
72 surface->surface_id(), frame.metadata.device_scale_factor, frame_size)); 72 surface->surface_id(), frame.metadata.device_scale_factor, frame_size));
73 } 73 }
74 surface->QueueFrame(std::move(frame), callback); 74 surface->QueueFrame(std::move(frame), callback);
75 if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) { 75 if (!manager_->SurfaceModified(SurfaceId(frame_sink_id_, local_frame_id))) {
76 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD); 76 TRACE_EVENT_INSTANT0("cc", "Damage not visible.", TRACE_EVENT_SCOPE_THREAD);
77 surface->RunDrawCallbacks(); 77 surface->RunDrawCallbacks();
78 } 78 }
79 if (current_surface_ && create_new_surface) { 79 if (current_surface_ && create_new_surface) {
80 surface->SetPreviousFrameSurface(current_surface_.get()); 80 surface->SetPreviousFrameSurface(current_surface_.get());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 manager_->RegisterSurface(surface.get()); 126 manager_->RegisterSurface(surface.get());
127 return surface; 127 return surface;
128 } 128 }
129 129
130 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { 130 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) {
131 if (manager_) 131 if (manager_)
132 manager_->Destroy(std::move(surface)); 132 manager_->Destroy(std::move(surface));
133 } 133 }
134 134
135 } // namespace cc 135 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/surfaces/surface_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698