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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 10689108: Aura: Have ui::Layer implement WebKit::WebExternalTextureLayerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer comments, remove dead code, plumb through context. Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "content/browser/renderer_host/backing_store_aura.h" 15 #include "content/browser/renderer_host/backing_store_aura.h"
16 #include "content/browser/renderer_host/dip_util.h" 16 #include "content/browser/renderer_host/dip_util.h"
17 #include "content/browser/renderer_host/image_transport_client.h"
18 #include "content/browser/renderer_host/render_widget_host_impl.h" 17 #include "content/browser/renderer_host/render_widget_host_impl.h"
19 #include "content/browser/renderer_host/web_input_event_aura.h" 18 #include "content/browser/renderer_host/web_input_event_aura.h"
20 #include "content/common/gpu/client/gl_helper.h" 19 #include "content/common/gpu/client/gl_helper.h"
21 #include "content/common/gpu/gpu_messages.h" 20 #include "content/common/gpu/gpu_messages.h"
22 #include "content/port/browser/render_widget_host_view_port.h" 21 #include "content/port/browser/render_widget_host_view_port.h"
23 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/user_metrics.h" 23 #include "content/public/browser/user_metrics.h"
25 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
29 #include "ui/aura/client/aura_constants.h" 28 #include "ui/aura/client/aura_constants.h"
30 #include "ui/aura/client/tooltip_client.h" 29 #include "ui/aura/client/tooltip_client.h"
31 #include "ui/aura/client/window_types.h" 30 #include "ui/aura/client/window_types.h"
32 #include "ui/aura/cursor_manager.h" 31 #include "ui/aura/cursor_manager.h"
33 #include "ui/aura/env.h" 32 #include "ui/aura/env.h"
34 #include "ui/aura/event.h" 33 #include "ui/aura/event.h"
35 #include "ui/aura/root_window.h" 34 #include "ui/aura/root_window.h"
36 #include "ui/aura/window.h" 35 #include "ui/aura/window.h"
37 #include "ui/aura/window_observer.h" 36 #include "ui/aura/window_observer.h"
38 #include "ui/base/gestures/gesture_recognizer.h" 37 #include "ui/base/gestures/gesture_recognizer.h"
39 #include "ui/base/hit_test.h" 38 #include "ui/base/hit_test.h"
40 #include "ui/base/ime/input_method.h" 39 #include "ui/base/ime/input_method.h"
41 #include "ui/base/ui_base_types.h" 40 #include "ui/base/ui_base_types.h"
42 #include "ui/compositor/compositor.h" 41 #include "ui/compositor/compositor.h"
42 #include "ui/compositor/compositor_switches.h"
43 #include "ui/compositor/layer.h" 43 #include "ui/compositor/layer.h"
44 #include "ui/gfx/canvas.h" 44 #include "ui/gfx/canvas.h"
45 #include "ui/gfx/display.h" 45 #include "ui/gfx/display.h"
46 #include "ui/gfx/screen.h" 46 #include "ui/gfx/screen.h"
47 #include "ui/gfx/skia_util.h" 47 #include "ui/gfx/skia_util.h"
48 48
49 using content::BrowserThread; 49 using content::BrowserThread;
50 using content::NativeWebKeyboardEvent; 50 using content::NativeWebKeyboardEvent;
51 using content::RenderWidgetHost; 51 using content::RenderWidgetHost;
52 using content::RenderWidgetHostImpl; 52 using content::RenderWidgetHostImpl;
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 void RenderWidgetHostViewAura::CopyFromCompositingSurface( 444 void RenderWidgetHostViewAura::CopyFromCompositingSurface(
445 const gfx::Size& size, 445 const gfx::Size& size,
446 skia::PlatformCanvas* output, 446 skia::PlatformCanvas* output,
447 base::Callback<void(bool)> callback) { 447 base::Callback<void(bool)> callback) {
448 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); 448 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
449 ui::Compositor* compositor = GetCompositor(); 449 ui::Compositor* compositor = GetCompositor();
450 if (!compositor) 450 if (!compositor)
451 return; 451 return;
452 452
453 std::map<uint64, scoped_refptr<ImageTransportClient> >::iterator it = 453 std::map<uint64, scoped_refptr<ui::Texture> >::iterator it =
454 image_transport_clients_.find(current_surface_); 454 image_transport_clients_.find(current_surface_);
455 if (it == image_transport_clients_.end()) 455 if (it == image_transport_clients_.end())
456 return; 456 return;
457 457
458 ImageTransportClient* container = it->second; 458 ui::Texture* container = it->second;
459 DCHECK(container); 459 DCHECK(container);
460 460
461 gfx::Size size_in_pixel = content::ConvertSizeToPixel(this, size); 461 gfx::Size size_in_pixel = content::ConvertSizeToPixel(this, size);
462 if (!output->initialize( 462 if (!output->initialize(
463 size_in_pixel.width(), size_in_pixel.height(), true)) 463 size_in_pixel.width(), size_in_pixel.height(), true))
464 return; 464 return;
465 465
466 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 466 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
467 content::GLHelper* gl_helper = factory->GetGLHelper(compositor); 467 content::GLHelper* gl_helper = factory->GetGLHelper(compositor);
468 if (!gl_helper) 468 if (!gl_helper)
(...skipping 29 matching lines...) Expand all
498 // Don't scale the contents in accelerated mode because the renderer takes 498 // Don't scale the contents in accelerated mode because the renderer takes
499 // care of it. 499 // care of it.
500 window_->layer()->set_scale_content( 500 window_->layer()->set_scale_content(
501 !host_->is_accelerated_compositing_active()); 501 !host_->is_accelerated_compositing_active());
502 502
503 accelerated_compositing_state_changed_ = false; 503 accelerated_compositing_state_changed_ = false;
504 } 504 }
505 505
506 if (current_surface_ != 0 && 506 if (current_surface_ != 0 &&
507 host_->is_accelerated_compositing_active()) { 507 host_->is_accelerated_compositing_active()) {
508 ImageTransportClient* container = 508 ui::Texture* container =
509 image_transport_clients_[current_surface_]; 509 image_transport_clients_[current_surface_];
510 if (container)
511 container->Update();
512 window_->SetExternalTexture(container); 510 window_->SetExternalTexture(container);
513 511
514 released_front_lock_ = NULL; 512 released_front_lock_ = NULL;
515 513
516 if (!container) { 514 if (!container) {
517 resize_locks_.clear(); 515 resize_locks_.clear();
518 } else { 516 } else {
519 typedef std::vector<linked_ptr<ResizeLock> > ResizeLockList; 517 typedef std::vector<linked_ptr<ResizeLock> > ResizeLockList;
520 ResizeLockList::iterator it = resize_locks_.begin(); 518 ResizeLockList::iterator it = resize_locks_.begin();
521 while (it != resize_locks_.end()) { 519 while (it != resize_locks_.end()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( 553 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped(
556 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, 554 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel,
557 int gpu_host_id) { 555 int gpu_host_id) {
558 current_surface_ = params_in_pixel.surface_handle; 556 current_surface_ = params_in_pixel.surface_handle;
559 UpdateExternalTexture(); 557 UpdateExternalTexture();
560 558
561 ui::Compositor* compositor = GetCompositor(); 559 ui::Compositor* compositor = GetCompositor();
562 if (!compositor) { 560 if (!compositor) {
563 // We have no compositor, so we have no way to display the surface. 561 // We have no compositor, so we have no way to display the surface.
564 // Must still send the ACK. 562 // Must still send the ACK.
565 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id); 563 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id, NULL);
566 } else { 564 } else {
567 gfx::Size surface_size_in_pixel = 565 gfx::Size surface_size_in_pixel =
568 image_transport_clients_[params_in_pixel.surface_handle]->size(); 566 image_transport_clients_[params_in_pixel.surface_handle]->size();
569 gfx::Size surface_size = content::ConvertSizeToDIP(this, 567 gfx::Size surface_size = content::ConvertSizeToDIP(this,
570 surface_size_in_pixel); 568 surface_size_in_pixel);
571 window_->SchedulePaintInRect(gfx::Rect(surface_size)); 569 window_->SchedulePaintInRect(gfx::Rect(surface_size));
572 570
573 if (!resize_locks_.empty()) { 571 if (!resize_locks_.empty()) {
574 // If we are waiting for the resize, fast-track the ACK. 572 // If we are waiting for the resize, fast-track the ACK.
575 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id); 573 if (CommandLine::ForCurrentProcess()->HasSwitch(
574 switches::kUIEnableThreadedCompositing)) {
piman 2012/07/12 00:18:09 Rather than testing the command line (and parsing
jonathan.backer 2012/07/12 13:53:22 Done.
575 // We need the compositor thread to pick up the active buffer before
576 // ACKing.
577 compositor->AddDidCommitCallback(
578 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK,
579 params_in_pixel.route_id,
580 gpu_host_id));
581 } else {
582 // The compositor will pickup the active buffer during a draw, so we
583 // can ACK immediately.
584 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id,
585 compositor);
586 }
576 } else { 587 } else {
577 // Add sending an ACK to the list of things to do OnCompositingWillStart 588 // Add sending an ACK to the list of things to do OnCompositingWillStart
578 on_compositing_will_start_callbacks_.push_back( 589 on_compositing_will_start_callbacks_.push_back(
579 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, 590 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK,
580 base::Unretained(this),
581 params_in_pixel.route_id, 591 params_in_pixel.route_id,
582 gpu_host_id)); 592 gpu_host_id));
583 if (!compositor->HasObserver(this)) 593 if (!compositor->HasObserver(this))
584 compositor->AddObserver(this); 594 compositor->AddObserver(this);
585 } 595 }
586 } 596 }
587 } 597 }
588 598
589 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( 599 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer(
590 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, 600 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel,
591 int gpu_host_id) { 601 int gpu_host_id) {
592 current_surface_ = params_in_pixel.surface_handle; 602 current_surface_ = params_in_pixel.surface_handle;
593 UpdateExternalTexture(); 603 UpdateExternalTexture();
594 604
595 ui::Compositor* compositor = GetCompositor(); 605 ui::Compositor* compositor = GetCompositor();
596 if (!compositor) { 606 if (!compositor) {
597 // We have no compositor, so we have no way to display the surface 607 // We have no compositor, so we have no way to display the surface
598 // Must still send the ACK 608 // Must still send the ACK
599 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id); 609 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id, NULL);
600 } else { 610 } else {
601 gfx::Size surface_size_in_pixel = 611 gfx::Size surface_size_in_pixel =
602 image_transport_clients_[params_in_pixel.surface_handle]->size(); 612 image_transport_clients_[params_in_pixel.surface_handle]->size();
603 613
604 // Co-ordinates come in OpenGL co-ordinate space. 614 // Co-ordinates come in OpenGL co-ordinate space.
605 // We need to convert to layer space. 615 // We need to convert to layer space.
606 gfx::Rect rect_to_paint = content::ConvertRectToDIP(this, gfx::Rect( 616 gfx::Rect rect_to_paint = content::ConvertRectToDIP(this, gfx::Rect(
607 params_in_pixel.x, 617 params_in_pixel.x,
608 surface_size_in_pixel.height() - params_in_pixel.y - 618 surface_size_in_pixel.height() - params_in_pixel.y -
609 params_in_pixel.height, 619 params_in_pixel.height,
610 params_in_pixel.width, 620 params_in_pixel.width,
611 params_in_pixel.height)); 621 params_in_pixel.height));
612 window_->SchedulePaintInRect(rect_to_paint); 622 window_->SchedulePaintInRect(rect_to_paint);
613 623
614 if (!resize_locks_.empty()) { 624 if (!resize_locks_.empty()) {
615 // If we are waiting for the resize, fast-track the ACK. 625 // If we are waiting for the resize, fast-track the ACK.
616 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id); 626 if (CommandLine::ForCurrentProcess()->HasSwitch(
627 switches::kUIEnableThreadedCompositing)) {
628 // We need the compositor thread to pick up the active buffer before
629 // ACKing.
630 compositor->AddDidCommitCallback(
631 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK,
632 params_in_pixel.route_id,
633 gpu_host_id));
634 } else {
635 // The compositor will pickup the active buffer during a draw, so we
636 // can ACK immediately.
637 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id,
638 compositor);
639 }
617 } else { 640 } else {
618 // Add sending an ACK to the list of things to do OnCompositingWillStart 641 // Add sending an ACK to the list of things to do OnCompositingWillStart
619 on_compositing_will_start_callbacks_.push_back( 642 on_compositing_will_start_callbacks_.push_back(
620 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, 643 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK,
621 base::Unretained(this),
622 params_in_pixel.route_id, 644 params_in_pixel.route_id,
623 gpu_host_id)); 645 gpu_host_id));
624 if (!compositor->HasObserver(this)) 646 if (!compositor->HasObserver(this))
625 compositor->AddObserver(this); 647 compositor->AddObserver(this);
626 } 648 }
627 } 649 }
628 } 650 }
629 651
630 void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() { 652 void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() {
631 } 653 }
632 654
633 bool RenderWidgetHostViewAura::HasAcceleratedSurface( 655 bool RenderWidgetHostViewAura::HasAcceleratedSurface(
634 const gfx::Size& desired_size) { 656 const gfx::Size& desired_size) {
635 // Aura doesn't use GetBackingStore for accelerated pages, so it doesn't 657 // Aura doesn't use GetBackingStore for accelerated pages, so it doesn't
636 // matter what is returned here as GetBackingStore is the only caller of this 658 // matter what is returned here as GetBackingStore is the only caller of this
637 // method. TODO(jbates) implement this if other Aura code needs it. 659 // method. TODO(jbates) implement this if other Aura code needs it.
638 return false; 660 return false;
639 } 661 }
640 662
663 // TODO(backer): Drop the |shm_handle| once I remove some unused service side
664 // code.
641 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( 665 void RenderWidgetHostViewAura::AcceleratedSurfaceNew(
642 int32 width_in_pixel, 666 int32 width_in_pixel,
643 int32 height_in_pixel, 667 int32 height_in_pixel,
644 uint64* surface_handle, 668 uint64* surface_handle,
645 TransportDIB::Handle* shm_handle) { 669 TransportDIB::Handle* shm_handle) {
646 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 670 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
647 scoped_refptr<ImageTransportClient> surface(factory->CreateTransportClient( 671 scoped_refptr<ui::Texture> surface(factory->CreateTransportClient(
648 gfx::Size(width_in_pixel, height_in_pixel), surface_handle)); 672 gfx::Size(width_in_pixel, height_in_pixel), surface_handle,
673 GetCompositor()));
649 if (!surface) { 674 if (!surface) {
650 LOG(ERROR) << "Failed to create ImageTransportClient"; 675 LOG(ERROR) << "Failed to create ImageTransport texture";
651 return; 676 return;
652 } 677 }
653 *shm_handle = surface->Handle();
654 678
655 image_transport_clients_[*surface_handle] = surface; 679 image_transport_clients_[*surface_handle] = surface;
656 } 680 }
657 681
658 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease( 682 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(
659 uint64 surface_handle) { 683 uint64 surface_handle) {
660 if (current_surface_ == surface_handle) { 684 if (current_surface_ == surface_handle) {
661 current_surface_ = 0; 685 current_surface_ = 0;
662 UpdateExternalTexture(); 686 UpdateExternalTexture();
663 } 687 }
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 1244
1221 void RenderWidgetHostViewAura::OnLostActive() { 1245 void RenderWidgetHostViewAura::OnLostActive() {
1222 } 1246 }
1223 1247
1224 //////////////////////////////////////////////////////////////////////////////// 1248 ////////////////////////////////////////////////////////////////////////////////
1225 // RenderWidgetHostViewAura, ui::CompositorObserver implementation: 1249 // RenderWidgetHostViewAura, ui::CompositorObserver implementation:
1226 1250
1227 1251
1228 void RenderWidgetHostViewAura::OnCompositingWillStart( 1252 void RenderWidgetHostViewAura::OnCompositingWillStart(
1229 ui::Compositor* compositor) { 1253 ui::Compositor* compositor) {
1230 RunCompositingCallbacks(); 1254 RunCompositingCallbacks(compositor);
1231 } 1255 }
1232 1256
1233 void RenderWidgetHostViewAura::OnCompositingStarted( 1257 void RenderWidgetHostViewAura::OnCompositingStarted(
1234 ui::Compositor* compositor) { 1258 ui::Compositor* compositor) {
1235 locks_pending_draw_.clear(); 1259 locks_pending_draw_.clear();
1236 compositor->RemoveObserver(this); 1260 compositor->RemoveObserver(this);
1237 } 1261 }
1238 1262
1239 void RenderWidgetHostViewAura::OnCompositingEnded(ui::Compositor* compositor) { 1263 void RenderWidgetHostViewAura::OnCompositingEnded(ui::Compositor* compositor) {
1240 } 1264 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 gfx::Rect rect = window_->bounds(); 1392 gfx::Rect rect = window_->bounds();
1369 int border_x = rect.width() * kMouseLockBorderPercentage / 100; 1393 int border_x = rect.width() * kMouseLockBorderPercentage / 100;
1370 int border_y = rect.height() * kMouseLockBorderPercentage / 100; 1394 int border_y = rect.height() * kMouseLockBorderPercentage / 100;
1371 1395
1372 return global_mouse_position_.x() < rect.x() + border_x || 1396 return global_mouse_position_.x() < rect.x() + border_x ||
1373 global_mouse_position_.x() > rect.right() - border_x || 1397 global_mouse_position_.x() > rect.right() - border_x ||
1374 global_mouse_position_.y() < rect.y() + border_y || 1398 global_mouse_position_.y() < rect.y() + border_y ||
1375 global_mouse_position_.y() > rect.bottom() - border_y; 1399 global_mouse_position_.y() > rect.bottom() - border_y;
1376 } 1400 }
1377 1401
1378 void RenderWidgetHostViewAura::RunCompositingCallbacks() { 1402 void RenderWidgetHostViewAura::RunCompositingCallbacks(
1379 for (std::vector< base::Callback<void(void)> >::const_iterator 1403 ui::Compositor* compositor) {
1404 for (std::vector< base::Callback<void(ui::Compositor*)> >::const_iterator
1380 it = on_compositing_will_start_callbacks_.begin(); 1405 it = on_compositing_will_start_callbacks_.begin();
1381 it != on_compositing_will_start_callbacks_.end(); ++it) { 1406 it != on_compositing_will_start_callbacks_.end(); ++it) {
1382 it->Run(); 1407 it->Run(compositor);
1383 } 1408 }
1384 on_compositing_will_start_callbacks_.clear(); 1409 on_compositing_will_start_callbacks_.clear();
1385 } 1410 }
1386 1411
1387 void RenderWidgetHostViewAura::InsertSyncPointAndACK(int32 route_id, 1412 // static
1388 int gpu_host_id) { 1413 void RenderWidgetHostViewAura::InsertSyncPointAndACK(
1389 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 1414 int32 route_id, int gpu_host_id, ui::Compositor* compositor) {
1415 uint32 sync_point = 0;
1416 // If we have no compositor, so we must still send the ACK. A zero
1417 // sync point will not be waited for in the GPU process.
1418 if (compositor) {
1419 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1420 sync_point = factory->InsertSyncPoint(compositor);
1421 }
1422
1390 RenderWidgetHostImpl::AcknowledgeBufferPresent( 1423 RenderWidgetHostImpl::AcknowledgeBufferPresent(
1391 route_id, gpu_host_id, factory->InsertSyncPoint(GetCompositor())); 1424 route_id, gpu_host_id, sync_point);
1392 } 1425 }
1393 1426
1394 void RenderWidgetHostViewAura::RemovingFromRootWindow() { 1427 void RenderWidgetHostViewAura::RemovingFromRootWindow() {
1395 // We are about to disconnect ourselves from the compositor, we need to issue 1428 // We are about to disconnect ourselves from the compositor, we need to issue
1396 // the callbacks now, because we won't get notified when the frame is done. 1429 // the callbacks now, because we won't get notified when the frame is done.
1397 // TODO(piman): this might in theory cause a race where the GPU process starts 1430 // TODO(piman): this might in theory cause a race where the GPU process starts
1398 // drawing to the buffer we haven't yet displayed. This will only show for 1 1431 // drawing to the buffer we haven't yet displayed. This will only show for 1
1399 // frame though, because we will reissue a new frame right away without that 1432 // frame though, because we will reissue a new frame right away without that
1400 // composited data. 1433 // composited data.
1401 RunCompositingCallbacks(); 1434 ui::Compositor* compositor = GetCompositor();
1435 RunCompositingCallbacks(compositor);
1402 locks_pending_draw_.clear(); 1436 locks_pending_draw_.clear();
1403 ui::Compositor* compositor = GetCompositor();
1404 if (compositor && compositor->HasObserver(this)) 1437 if (compositor && compositor->HasObserver(this))
1405 compositor->RemoveObserver(this); 1438 compositor->RemoveObserver(this);
1406 DetachFromInputMethod(); 1439 DetachFromInputMethod();
1407 } 1440 }
1408 1441
1409 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() { 1442 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() {
1410 aura::RootWindow* root_window = window_->GetRootWindow(); 1443 aura::RootWindow* root_window = window_->GetRootWindow();
1411 return root_window ? root_window->compositor() : NULL; 1444 return root_window ? root_window->compositor() : NULL;
1412 } 1445 }
1413 1446
(...skipping 10 matching lines...) Expand all
1424 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( 1457 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
1425 RenderWidgetHost* widget) { 1458 RenderWidgetHost* widget) {
1426 return new RenderWidgetHostViewAura(widget); 1459 return new RenderWidgetHostViewAura(widget);
1427 } 1460 }
1428 1461
1429 // static 1462 // static
1430 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( 1463 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo(
1431 WebKit::WebScreenInfo* results) { 1464 WebKit::WebScreenInfo* results) {
1432 GetScreenInfoForWindow(results, NULL); 1465 GetScreenInfoForWindow(results, NULL);
1433 } 1466 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698