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

Side by Side Diff: ash/laser/laser_pointer_view.cc

Issue 2807653003: Move Work From CompositorFrameSinkSupport() To Init() (Closed)
Patch Set: Add CompositorFrameSinkSupport::Create Created 3 years, 8 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 | « ash/laser/laser_pointer_view.h ('k') | cc/surfaces/compositor_frame_sink_support.h » ('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 "ash/laser/laser_pointer_view.h" 5 #include "ash/laser/laser_pointer_view.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 10
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // LaserPointerView 204 // LaserPointerView
205 LaserPointerView::LaserPointerView(base::TimeDelta life_duration, 205 LaserPointerView::LaserPointerView(base::TimeDelta life_duration,
206 base::TimeDelta presentation_delay, 206 base::TimeDelta presentation_delay,
207 aura::Window* root_window) 207 aura::Window* root_window)
208 : laser_points_(life_duration), 208 : laser_points_(life_duration),
209 predicted_laser_points_(life_duration), 209 predicted_laser_points_(life_duration),
210 presentation_delay_(presentation_delay), 210 presentation_delay_(presentation_delay),
211 frame_sink_id_(aura::Env::GetInstance() 211 frame_sink_id_(aura::Env::GetInstance()
212 ->context_factory_private() 212 ->context_factory_private()
213 ->AllocateFrameSinkId()), 213 ->AllocateFrameSinkId()),
214 frame_sink_support_(this, 214 frame_sink_support_(cc::CompositorFrameSinkSupport::Create(
215 aura::Env::GetInstance() 215 this,
216 ->context_factory_private() 216 aura::Env::GetInstance()
217 ->GetSurfaceManager(), 217 ->context_factory_private()
218 frame_sink_id_, 218 ->GetSurfaceManager(),
219 false /* is_root */, 219 frame_sink_id_,
220 true /* handles_frame_sink_id_invalidation */, 220 false /* is_root */,
221 true /* needs_sync_points */), 221 true /* handles_frame_sink_id_invalidation */,
222 true /* needs_sync_points */)),
222 weak_ptr_factory_(this) { 223 weak_ptr_factory_(this) {
223 widget_.reset(new views::Widget); 224 widget_.reset(new views::Widget);
224 views::Widget::InitParams params; 225 views::Widget::InitParams params;
225 params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; 226 params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
226 params.name = "LaserOverlay"; 227 params.name = "LaserOverlay";
227 params.accept_events = false; 228 params.accept_events = false;
228 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; 229 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;
229 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 230 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
230 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 231 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
231 params.parent = 232 params.parent =
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 // fading away. 372 // fading away.
372 base::TimeTicks next_presentation_time = 373 base::TimeTicks next_presentation_time =
373 ui::EventTimeForNow() + presentation_delay_; 374 ui::EventTimeForNow() + presentation_delay_;
374 laser_points_.MoveForwardToTime(next_presentation_time); 375 laser_points_.MoveForwardToTime(next_presentation_time);
375 predicted_laser_points_.MoveForwardToTime(next_presentation_time); 376 predicted_laser_points_.MoveForwardToTime(next_presentation_time);
376 buffer_damage_rect_.Union(GetBoundingBox()); 377 buffer_damage_rect_.Union(GetBoundingBox());
377 OnPointsUpdated(); 378 OnPointsUpdated();
378 } 379 }
379 380
380 void LaserPointerView::SetNeedsBeginFrame(bool needs_begin_frame) { 381 void LaserPointerView::SetNeedsBeginFrame(bool needs_begin_frame) {
381 frame_sink_support_.SetNeedsBeginFrame(needs_begin_frame); 382 frame_sink_support_->SetNeedsBeginFrame(needs_begin_frame);
382 } 383 }
383 384
384 void LaserPointerView::SubmitCompositorFrame( 385 void LaserPointerView::SubmitCompositorFrame(
385 const cc::LocalSurfaceId& local_surface_id, 386 const cc::LocalSurfaceId& local_surface_id,
386 cc::CompositorFrame frame) { 387 cc::CompositorFrame frame) {
387 frame_sink_support_.SubmitCompositorFrame(local_surface_id, std::move(frame)); 388 frame_sink_support_->SubmitCompositorFrame(local_surface_id,
389 std::move(frame));
388 } 390 }
389 391
390 void LaserPointerView::BeginFrameDidNotSwap( 392 void LaserPointerView::BeginFrameDidNotSwap(
391 const cc::BeginFrameAck& begin_frame_ack) { 393 const cc::BeginFrameAck& begin_frame_ack) {
392 frame_sink_support_.BeginFrameDidNotSwap(begin_frame_ack); 394 frame_sink_support_->BeginFrameDidNotSwap(begin_frame_ack);
393 } 395 }
394 396
395 void LaserPointerView::EvictFrame() { 397 void LaserPointerView::EvictFrame() {
396 frame_sink_support_.EvictFrame(); 398 frame_sink_support_->EvictFrame();
397 } 399 }
398 400
399 void LaserPointerView::DidReceiveCompositorFrameAck() { 401 void LaserPointerView::DidReceiveCompositorFrameAck() {
400 base::ThreadTaskRunnerHandle::Get()->PostTask( 402 base::ThreadTaskRunnerHandle::Get()->PostTask(
401 FROM_HERE, base::Bind(&LaserPointerView::OnDidDrawSurface, 403 FROM_HERE, base::Bind(&LaserPointerView::OnDidDrawSurface,
402 weak_ptr_factory_.GetWeakPtr())); 404 weak_ptr_factory_.GetWeakPtr()));
403 } 405 }
404 406
405 void LaserPointerView::ReclaimResources( 407 void LaserPointerView::ReclaimResources(
406 const cc::ReturnedResourceArray& resources) { 408 const cc::ReturnedResourceArray& resources) {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 pending_draw_surface_ = true; 722 pending_draw_surface_ = true;
721 } 723 }
722 724
723 void LaserPointerView::OnDidDrawSurface() { 725 void LaserPointerView::OnDidDrawSurface() {
724 pending_draw_surface_ = false; 726 pending_draw_surface_ = false;
725 if (needs_update_surface_) 727 if (needs_update_surface_)
726 UpdateSurface(); 728 UpdateSurface();
727 } 729 }
728 730
729 } // namespace ash 731 } // namespace ash
OLDNEW
« no previous file with comments | « ash/laser/laser_pointer_view.h ('k') | cc/surfaces/compositor_frame_sink_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698