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

Side by Side Diff: services/ui/ws/frame_generator.cc

Issue 2176303002: services/ui: Remove deprecated gpu code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot-merge Created 4 years, 4 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 | « services/ui/ws/frame_generator.h ('k') | services/ui/ws/frame_generator_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/ui/ws/frame_generator.h" 5 #include "services/ui/ws/frame_generator.h"
6 6
7 #include "base/containers/adapters.h" 7 #include "base/containers/adapters.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/quads/render_pass.h" 9 #include "cc/quads/render_pass.h"
10 #include "cc/quads/render_pass_draw_quad.h" 10 #include "cc/quads/render_pass_draw_quad.h"
11 #include "cc/quads/shared_quad_state.h" 11 #include "cc/quads/shared_quad_state.h"
12 #include "cc/quads/surface_draw_quad.h" 12 #include "cc/quads/surface_draw_quad.h"
13 #include "services/ui/surfaces/display_compositor.h" 13 #include "services/ui/surfaces/display_compositor.h"
14 #include "services/ui/ws/frame_generator_delegate.h" 14 #include "services/ui/ws/frame_generator_delegate.h"
15 #include "services/ui/ws/server_window.h" 15 #include "services/ui/ws/server_window.h"
16 #include "services/ui/ws/server_window_surface.h" 16 #include "services/ui/ws/server_window_surface.h"
17 #include "services/ui/ws/server_window_surface_manager.h" 17 #include "services/ui/ws/server_window_surface_manager.h"
18 18
19 namespace ui { 19 namespace ui {
20 20
21 namespace ws { 21 namespace ws {
22 22
23 FrameGenerator::FrameGenerator(FrameGeneratorDelegate* delegate, 23 FrameGenerator::FrameGenerator(FrameGeneratorDelegate* delegate,
24 scoped_refptr<GpuState> gpu_state,
25 scoped_refptr<SurfacesState> surfaces_state) 24 scoped_refptr<SurfacesState> surfaces_state)
26 : delegate_(delegate), 25 : delegate_(delegate),
27 gpu_state_(gpu_state),
28 surfaces_state_(surfaces_state), 26 surfaces_state_(surfaces_state),
29 draw_timer_(false, false), 27 draw_timer_(false, false),
30 weak_factory_(this) { 28 weak_factory_(this) {
31 DCHECK(delegate_); 29 DCHECK(delegate_);
32 } 30 }
33 31
34 FrameGenerator::~FrameGenerator() { 32 FrameGenerator::~FrameGenerator() {
35 // Invalidate WeakPtrs now to avoid callbacks back into the 33 // Invalidate WeakPtrs now to avoid callbacks back into the
36 // FrameGenerator during destruction of |display_compositor_|. 34 // FrameGenerator during destruction of |display_compositor_|.
37 weak_factory_.InvalidateWeakPtrs(); 35 weak_factory_.InvalidateWeakPtrs();
38 display_compositor_.reset(); 36 display_compositor_.reset();
39 } 37 }
40 38
41 void FrameGenerator::RequestRedraw(const gfx::Rect& redraw_region) { 39 void FrameGenerator::RequestRedraw(const gfx::Rect& redraw_region) {
42 dirty_rect_.Union(redraw_region); 40 dirty_rect_.Union(redraw_region);
43 WantToDraw(); 41 WantToDraw();
44 } 42 }
45 43
46 void FrameGenerator::OnAcceleratedWidgetAvailable( 44 void FrameGenerator::OnAcceleratedWidgetAvailable(
47 gfx::AcceleratedWidget widget) { 45 gfx::AcceleratedWidget widget) {
48 if (widget != gfx::kNullAcceleratedWidget) { 46 if (widget != gfx::kNullAcceleratedWidget) {
49 display_compositor_.reset( 47 display_compositor_.reset(new DisplayCompositor(
50 new DisplayCompositor(base::ThreadTaskRunnerHandle::Get(), widget, 48 base::ThreadTaskRunnerHandle::Get(), widget, surfaces_state_));
51 gpu_state_, surfaces_state_));
52 } 49 }
53 } 50 }
54 51
55 void FrameGenerator::RequestCopyOfOutput( 52 void FrameGenerator::RequestCopyOfOutput(
56 std::unique_ptr<cc::CopyOutputRequest> output_request) { 53 std::unique_ptr<cc::CopyOutputRequest> output_request) {
57 if (display_compositor_) 54 if (display_compositor_)
58 display_compositor_->RequestCopyOfOutput(std::move(output_request)); 55 display_compositor_->RequestCopyOfOutput(std::move(output_request));
59 } 56 }
60 57
61 void FrameGenerator::WantToDraw() { 58 void FrameGenerator::WantToDraw() {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 quad->SetAll(sqs, bounds_at_origin /* rect */, 197 quad->SetAll(sqs, bounds_at_origin /* rect */,
201 gfx::Rect() /* opaque_rect */, 198 gfx::Rect() /* opaque_rect */,
202 bounds_at_origin /* visible_rect */, true /* needs_blending*/, 199 bounds_at_origin /* visible_rect */, true /* needs_blending*/,
203 underlay_surface->id()); 200 underlay_surface->id());
204 } 201 }
205 } 202 }
206 203
207 } // namespace ws 204 } // namespace ws
208 205
209 } // namespace ui 206 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/frame_generator.h ('k') | services/ui/ws/frame_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698