OLD | NEW |
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" |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 | 442 |
444 void RenderWidgetHostViewAura::CopyFromCompositingSurface( | 443 void RenderWidgetHostViewAura::CopyFromCompositingSurface( |
445 const gfx::Size& size, | 444 const gfx::Size& size, |
446 skia::PlatformCanvas* output, | 445 skia::PlatformCanvas* output, |
447 base::Callback<void(bool)> callback) { | 446 base::Callback<void(bool)> callback) { |
448 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 447 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
449 ui::Compositor* compositor = GetCompositor(); | 448 ui::Compositor* compositor = GetCompositor(); |
450 if (!compositor) | 449 if (!compositor) |
451 return; | 450 return; |
452 | 451 |
453 std::map<uint64, scoped_refptr<ImageTransportClient> >::iterator it = | 452 std::map<uint64, scoped_refptr<ui::Texture> >::iterator it = |
454 image_transport_clients_.find(current_surface_); | 453 image_transport_clients_.find(current_surface_); |
455 if (it == image_transport_clients_.end()) | 454 if (it == image_transport_clients_.end()) |
456 return; | 455 return; |
457 | 456 |
458 ImageTransportClient* container = it->second; | 457 ui::Texture* container = it->second; |
459 DCHECK(container); | 458 DCHECK(container); |
460 | 459 |
461 gfx::Size size_in_pixel = content::ConvertSizeToPixel(this, size); | 460 gfx::Size size_in_pixel = content::ConvertSizeToPixel(this, size); |
462 if (!output->initialize( | 461 if (!output->initialize( |
463 size_in_pixel.width(), size_in_pixel.height(), true)) | 462 size_in_pixel.width(), size_in_pixel.height(), true)) |
464 return; | 463 return; |
465 | 464 |
466 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 465 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
467 content::GLHelper* gl_helper = factory->GetGLHelper(compositor); | 466 content::GLHelper* gl_helper = factory->GetGLHelper(compositor); |
468 if (!gl_helper) | 467 if (!gl_helper) |
(...skipping 29 matching lines...) Expand all Loading... |
498 // Don't scale the contents in accelerated mode because the renderer takes | 497 // Don't scale the contents in accelerated mode because the renderer takes |
499 // care of it. | 498 // care of it. |
500 window_->layer()->set_scale_content( | 499 window_->layer()->set_scale_content( |
501 !host_->is_accelerated_compositing_active()); | 500 !host_->is_accelerated_compositing_active()); |
502 | 501 |
503 accelerated_compositing_state_changed_ = false; | 502 accelerated_compositing_state_changed_ = false; |
504 } | 503 } |
505 | 504 |
506 if (current_surface_ != 0 && | 505 if (current_surface_ != 0 && |
507 host_->is_accelerated_compositing_active()) { | 506 host_->is_accelerated_compositing_active()) { |
508 ImageTransportClient* container = | 507 ui::Texture* container = |
509 image_transport_clients_[current_surface_]; | 508 image_transport_clients_[current_surface_]; |
510 if (container) | |
511 container->Update(); | |
512 window_->SetExternalTexture(container); | 509 window_->SetExternalTexture(container); |
513 | 510 |
514 released_front_lock_ = NULL; | 511 released_front_lock_ = NULL; |
515 | 512 |
516 if (!container) { | 513 if (!container) { |
517 resize_locks_.clear(); | 514 resize_locks_.clear(); |
518 } else { | 515 } else { |
519 typedef std::vector<linked_ptr<ResizeLock> > ResizeLockList; | 516 typedef std::vector<linked_ptr<ResizeLock> > ResizeLockList; |
520 ResizeLockList::iterator it = resize_locks_.begin(); | 517 ResizeLockList::iterator it = resize_locks_.begin(); |
521 while (it != resize_locks_.end()) { | 518 while (it != resize_locks_.end()) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 552 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
556 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, | 553 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, |
557 int gpu_host_id) { | 554 int gpu_host_id) { |
558 current_surface_ = params_in_pixel.surface_handle; | 555 current_surface_ = params_in_pixel.surface_handle; |
559 UpdateExternalTexture(); | 556 UpdateExternalTexture(); |
560 | 557 |
561 ui::Compositor* compositor = GetCompositor(); | 558 ui::Compositor* compositor = GetCompositor(); |
562 if (!compositor) { | 559 if (!compositor) { |
563 // We have no compositor, so we have no way to display the surface. | 560 // We have no compositor, so we have no way to display the surface. |
564 // Must still send the ACK. | 561 // Must still send the ACK. |
565 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id); | 562 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id, NULL); |
566 } else { | 563 } else { |
567 gfx::Size surface_size_in_pixel = | 564 gfx::Size surface_size_in_pixel = |
568 image_transport_clients_[params_in_pixel.surface_handle]->size(); | 565 image_transport_clients_[params_in_pixel.surface_handle]->size(); |
569 gfx::Size surface_size = content::ConvertSizeToDIP(this, | 566 gfx::Size surface_size = content::ConvertSizeToDIP(this, |
570 surface_size_in_pixel); | 567 surface_size_in_pixel); |
571 window_->SchedulePaintInRect(gfx::Rect(surface_size)); | 568 window_->SchedulePaintInRect(gfx::Rect(surface_size)); |
572 | 569 |
573 if (!resize_locks_.empty()) { | 570 if (!resize_locks_.empty()) { |
574 // If we are waiting for the resize, fast-track the ACK. | 571 // If we are waiting for the resize, fast-track the ACK. |
575 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id); | 572 if (compositor->IsThreaded()) { |
| 573 // We need the compositor thread to pick up the active buffer before |
| 574 // ACKing. |
| 575 on_compositing_did_commit_callbacks_.push_back( |
| 576 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, |
| 577 params_in_pixel.route_id, |
| 578 gpu_host_id)); |
| 579 if (!compositor->HasObserver(this)) |
| 580 compositor->AddObserver(this); |
| 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 (compositor->IsThreaded()) { |
| 627 // We need the compositor thread to pick up the active buffer before |
| 628 // ACKing. |
| 629 on_compositing_did_commit_callbacks_.push_back( |
| 630 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, |
| 631 params_in_pixel.route_id, |
| 632 gpu_host_id)); |
| 633 if (!compositor->HasObserver(this)) |
| 634 compositor->AddObserver(this); |
| 635 } else { |
| 636 // The compositor will pickup the active buffer during a draw, so we |
| 637 // can ACK immediately. |
| 638 InsertSyncPointAndACK(params_in_pixel.route_id, gpu_host_id, |
| 639 compositor); |
| 640 } |
617 } else { | 641 } else { |
618 // Add sending an ACK to the list of things to do OnCompositingWillStart | 642 // Add sending an ACK to the list of things to do OnCompositingWillStart |
619 on_compositing_will_start_callbacks_.push_back( | 643 on_compositing_will_start_callbacks_.push_back( |
620 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, | 644 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, |
621 base::Unretained(this), | |
622 params_in_pixel.route_id, | 645 params_in_pixel.route_id, |
623 gpu_host_id)); | 646 gpu_host_id)); |
624 if (!compositor->HasObserver(this)) | 647 if (!compositor->HasObserver(this)) |
625 compositor->AddObserver(this); | 648 compositor->AddObserver(this); |
626 } | 649 } |
627 } | 650 } |
628 } | 651 } |
629 | 652 |
630 void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() { | 653 void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() { |
631 } | 654 } |
632 | 655 |
633 bool RenderWidgetHostViewAura::HasAcceleratedSurface( | 656 bool RenderWidgetHostViewAura::HasAcceleratedSurface( |
634 const gfx::Size& desired_size) { | 657 const gfx::Size& desired_size) { |
635 // Aura doesn't use GetBackingStore for accelerated pages, so it doesn't | 658 // 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 | 659 // 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. | 660 // method. TODO(jbates) implement this if other Aura code needs it. |
638 return false; | 661 return false; |
639 } | 662 } |
640 | 663 |
| 664 // TODO(backer): Drop the |shm_handle| once I remove some unused service side |
| 665 // code. |
641 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( | 666 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( |
642 int32 width_in_pixel, | 667 int32 width_in_pixel, |
643 int32 height_in_pixel, | 668 int32 height_in_pixel, |
644 uint64* surface_handle, | 669 uint64* surface_handle, |
645 TransportDIB::Handle* shm_handle) { | 670 TransportDIB::Handle* shm_handle) { |
646 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 671 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
647 scoped_refptr<ImageTransportClient> surface(factory->CreateTransportClient( | 672 scoped_refptr<ui::Texture> surface(factory->CreateTransportClient( |
648 gfx::Size(width_in_pixel, height_in_pixel), surface_handle)); | 673 gfx::Size(width_in_pixel, height_in_pixel), surface_handle, |
| 674 GetCompositor())); |
649 if (!surface) { | 675 if (!surface) { |
650 LOG(ERROR) << "Failed to create ImageTransportClient"; | 676 LOG(ERROR) << "Failed to create ImageTransport texture"; |
651 return; | 677 return; |
652 } | 678 } |
653 *shm_handle = surface->Handle(); | |
654 | 679 |
655 image_transport_clients_[*surface_handle] = surface; | 680 image_transport_clients_[*surface_handle] = surface; |
656 } | 681 } |
657 | 682 |
658 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease( | 683 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease( |
659 uint64 surface_handle) { | 684 uint64 surface_handle) { |
660 if (current_surface_ == surface_handle) { | 685 if (current_surface_ == surface_handle) { |
661 current_surface_ = 0; | 686 current_surface_ = 0; |
662 UpdateExternalTexture(); | 687 UpdateExternalTexture(); |
663 } | 688 } |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 | 1242 |
1218 void RenderWidgetHostViewAura::OnActivated() { | 1243 void RenderWidgetHostViewAura::OnActivated() { |
1219 } | 1244 } |
1220 | 1245 |
1221 void RenderWidgetHostViewAura::OnLostActive() { | 1246 void RenderWidgetHostViewAura::OnLostActive() { |
1222 } | 1247 } |
1223 | 1248 |
1224 //////////////////////////////////////////////////////////////////////////////// | 1249 //////////////////////////////////////////////////////////////////////////////// |
1225 // RenderWidgetHostViewAura, ui::CompositorObserver implementation: | 1250 // RenderWidgetHostViewAura, ui::CompositorObserver implementation: |
1226 | 1251 |
| 1252 void RenderWidgetHostViewAura::OnCompositingDidCommit( |
| 1253 ui::Compositor* compositor) { |
| 1254 RunCompositingDidCommitCallbacks(compositor); |
| 1255 } |
1227 | 1256 |
1228 void RenderWidgetHostViewAura::OnCompositingWillStart( | 1257 void RenderWidgetHostViewAura::OnCompositingWillStart( |
1229 ui::Compositor* compositor) { | 1258 ui::Compositor* compositor) { |
1230 RunCompositingCallbacks(); | 1259 RunCompositingWillStartCallbacks(compositor); |
1231 } | 1260 } |
1232 | 1261 |
1233 void RenderWidgetHostViewAura::OnCompositingStarted( | 1262 void RenderWidgetHostViewAura::OnCompositingStarted( |
1234 ui::Compositor* compositor) { | 1263 ui::Compositor* compositor) { |
1235 locks_pending_draw_.clear(); | 1264 locks_pending_draw_.clear(); |
1236 compositor->RemoveObserver(this); | |
1237 } | 1265 } |
1238 | 1266 |
1239 void RenderWidgetHostViewAura::OnCompositingEnded(ui::Compositor* compositor) { | 1267 void RenderWidgetHostViewAura::OnCompositingEnded( |
| 1268 ui::Compositor* compositor) { |
1240 } | 1269 } |
1241 | 1270 |
1242 void RenderWidgetHostViewAura::OnCompositingAborted( | 1271 void RenderWidgetHostViewAura::OnCompositingAborted( |
1243 ui::Compositor* compositor) { | 1272 ui::Compositor* compositor) { |
1244 } | 1273 } |
1245 | 1274 |
1246 //////////////////////////////////////////////////////////////////////////////// | 1275 //////////////////////////////////////////////////////////////////////////////// |
1247 // RenderWidgetHostViewAura, ImageTransportFactoryObserver implementation: | 1276 // RenderWidgetHostViewAura, ImageTransportFactoryObserver implementation: |
1248 | 1277 |
1249 void RenderWidgetHostViewAura::OnLostResources(ui::Compositor* compositor) { | 1278 void RenderWidgetHostViewAura::OnLostResources(ui::Compositor* compositor) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 gfx::Rect rect = window_->bounds(); | 1397 gfx::Rect rect = window_->bounds(); |
1369 int border_x = rect.width() * kMouseLockBorderPercentage / 100; | 1398 int border_x = rect.width() * kMouseLockBorderPercentage / 100; |
1370 int border_y = rect.height() * kMouseLockBorderPercentage / 100; | 1399 int border_y = rect.height() * kMouseLockBorderPercentage / 100; |
1371 | 1400 |
1372 return global_mouse_position_.x() < rect.x() + border_x || | 1401 return global_mouse_position_.x() < rect.x() + border_x || |
1373 global_mouse_position_.x() > rect.right() - border_x || | 1402 global_mouse_position_.x() > rect.right() - border_x || |
1374 global_mouse_position_.y() < rect.y() + border_y || | 1403 global_mouse_position_.y() < rect.y() + border_y || |
1375 global_mouse_position_.y() > rect.bottom() - border_y; | 1404 global_mouse_position_.y() > rect.bottom() - border_y; |
1376 } | 1405 } |
1377 | 1406 |
1378 void RenderWidgetHostViewAura::RunCompositingCallbacks() { | 1407 void RenderWidgetHostViewAura::RunCompositingDidCommitCallbacks( |
1379 for (std::vector< base::Callback<void(void)> >::const_iterator | 1408 ui::Compositor* compositor) { |
| 1409 for (std::vector< base::Callback<void(ui::Compositor*)> >::const_iterator |
| 1410 it = on_compositing_did_commit_callbacks_.begin(); |
| 1411 it != on_compositing_did_commit_callbacks_.end(); ++it) { |
| 1412 it->Run(compositor); |
| 1413 } |
| 1414 on_compositing_did_commit_callbacks_.clear(); |
| 1415 } |
| 1416 |
| 1417 void RenderWidgetHostViewAura::RunCompositingWillStartCallbacks( |
| 1418 ui::Compositor* compositor) { |
| 1419 for (std::vector< base::Callback<void(ui::Compositor*)> >::const_iterator |
1380 it = on_compositing_will_start_callbacks_.begin(); | 1420 it = on_compositing_will_start_callbacks_.begin(); |
1381 it != on_compositing_will_start_callbacks_.end(); ++it) { | 1421 it != on_compositing_will_start_callbacks_.end(); ++it) { |
1382 it->Run(); | 1422 it->Run(compositor); |
1383 } | 1423 } |
1384 on_compositing_will_start_callbacks_.clear(); | 1424 on_compositing_will_start_callbacks_.clear(); |
1385 } | 1425 } |
1386 | 1426 |
1387 void RenderWidgetHostViewAura::InsertSyncPointAndACK(int32 route_id, | 1427 // static |
1388 int gpu_host_id) { | 1428 void RenderWidgetHostViewAura::InsertSyncPointAndACK( |
1389 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1429 int32 route_id, int gpu_host_id, ui::Compositor* compositor) { |
| 1430 uint32 sync_point = 0; |
| 1431 // If we have no compositor, so we must still send the ACK. A zero |
| 1432 // sync point will not be waited for in the GPU process. |
| 1433 if (compositor) { |
| 1434 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 1435 sync_point = factory->InsertSyncPoint(compositor); |
| 1436 } |
| 1437 |
1390 RenderWidgetHostImpl::AcknowledgeBufferPresent( | 1438 RenderWidgetHostImpl::AcknowledgeBufferPresent( |
1391 route_id, gpu_host_id, factory->InsertSyncPoint(GetCompositor())); | 1439 route_id, gpu_host_id, sync_point); |
1392 } | 1440 } |
1393 | 1441 |
1394 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 1442 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
1395 // We are about to disconnect ourselves from the compositor, we need to issue | 1443 // 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. | 1444 // 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 | 1445 // 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 | 1446 // 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 | 1447 // frame though, because we will reissue a new frame right away without that |
1400 // composited data. | 1448 // composited data. |
1401 RunCompositingCallbacks(); | 1449 ui::Compositor* compositor = GetCompositor(); |
| 1450 RunCompositingDidCommitCallbacks(compositor); |
| 1451 RunCompositingWillStartCallbacks(compositor); |
1402 locks_pending_draw_.clear(); | 1452 locks_pending_draw_.clear(); |
1403 ui::Compositor* compositor = GetCompositor(); | |
1404 if (compositor && compositor->HasObserver(this)) | 1453 if (compositor && compositor->HasObserver(this)) |
1405 compositor->RemoveObserver(this); | 1454 compositor->RemoveObserver(this); |
1406 DetachFromInputMethod(); | 1455 DetachFromInputMethod(); |
1407 } | 1456 } |
1408 | 1457 |
1409 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() { | 1458 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() { |
1410 aura::RootWindow* root_window = window_->GetRootWindow(); | 1459 aura::RootWindow* root_window = window_->GetRootWindow(); |
1411 return root_window ? root_window->compositor() : NULL; | 1460 return root_window ? root_window->compositor() : NULL; |
1412 } | 1461 } |
1413 | 1462 |
(...skipping 10 matching lines...) Expand all Loading... |
1424 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 1473 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
1425 RenderWidgetHost* widget) { | 1474 RenderWidgetHost* widget) { |
1426 return new RenderWidgetHostViewAura(widget); | 1475 return new RenderWidgetHostViewAura(widget); |
1427 } | 1476 } |
1428 | 1477 |
1429 // static | 1478 // static |
1430 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 1479 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
1431 WebKit::WebScreenInfo* results) { | 1480 WebKit::WebScreenInfo* results) { |
1432 GetScreenInfoForWindow(results, NULL); | 1481 GetScreenInfoForWindow(results, NULL); |
1433 } | 1482 } |
OLD | NEW |