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

Side by Side Diff: content/renderer/render_widget.cc

Issue 1129883003: Pass Surface ID namespace to renderer compositors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set initial namespace value Created 5 years, 7 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
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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 blink::WebPopupTypeNone, screen_info, false, hidden, false)); 560 blink::WebPopupTypeNone, screen_info, false, hidden, false));
561 widget->routing_id_ = routing_id; 561 widget->routing_id_ = routing_id;
562 widget->surface_id_ = surface_id; 562 widget->surface_id_ = surface_id;
563 widget->compositor_deps_ = compositor_deps; 563 widget->compositor_deps_ = compositor_deps;
564 widget->for_oopif_ = true; 564 widget->for_oopif_ = true;
565 // DoInit increments the reference count on |widget|, keeping it alive after 565 // DoInit increments the reference count on |widget|, keeping it alive after
566 // this function returns. 566 // this function returns.
567 if (widget->DoInit(MSG_ROUTING_NONE, compositor_deps, 567 if (widget->DoInit(MSG_ROUTING_NONE, compositor_deps,
568 RenderWidget::CreateWebFrameWidget(widget.get(), frame), 568 RenderWidget::CreateWebFrameWidget(widget.get(), frame),
569 nullptr)) { 569 nullptr)) {
570 widget->CompleteInit(); 570 // TODO(kenrb): Child frames need support for Surface IDs.
571 widget->CompleteInit(0);
571 return widget.get(); 572 return widget.get();
572 } 573 }
573 return nullptr; 574 return nullptr;
574 } 575 }
575 576
576 // static 577 // static
577 blink::WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) { 578 blink::WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) {
578 switch (render_widget->popup_type_) { 579 switch (render_widget->popup_type_) {
579 case blink::WebPopupTypeNone: // Nothing to create. 580 case blink::WebPopupTypeNone: // Nothing to create.
580 break; 581 break;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 RenderThreadImpl::current()->WidgetHidden(); 631 RenderThreadImpl::current()->WidgetHidden();
631 } 632 }
632 return true; 633 return true;
633 } else { 634 } else {
634 // The above Send can fail when the tab is closing. 635 // The above Send can fail when the tab is closing.
635 return false; 636 return false;
636 } 637 }
637 } 638 }
638 639
639 // This is used to complete pending inits and non-pending inits. 640 // This is used to complete pending inits and non-pending inits.
640 void RenderWidget::CompleteInit() { 641 void RenderWidget::CompleteInit(uint32_t surface_id_namespace) {
641 DCHECK(routing_id_ != MSG_ROUTING_NONE); 642 DCHECK(routing_id_ != MSG_ROUTING_NONE);
642 643
643 init_complete_ = true; 644 init_complete_ = true;
644 645
645 if (compositor_) 646 if (compositor_) {
646 StartCompositor(); 647 StartCompositor();
648 compositor_->SetSurfaceIdNamespace(surface_id_namespace);
649 }
647 650
648 Send(new ViewHostMsg_RenderViewReady(routing_id_)); 651 Send(new ViewHostMsg_RenderViewReady(routing_id_));
649 } 652 }
650 653
651 void RenderWidget::SetSwappedOut(bool is_swapped_out) { 654 void RenderWidget::SetSwappedOut(bool is_swapped_out) {
652 // We should only toggle between states. 655 // We should only toggle between states.
653 DCHECK(is_swapped_out_ != is_swapped_out); 656 DCHECK(is_swapped_out_ != is_swapped_out);
654 is_swapped_out_ = is_swapped_out; 657 is_swapped_out_ = is_swapped_out;
655 658
656 // If we are swapping out, we will call ReleaseProcess, allowing the process 659 // If we are swapping out, we will call ReleaseProcess, allowing the process
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown) 745 IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown)
743 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) 746 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive)
744 IPC_MESSAGE_HANDLER(ViewMsg_CandidateWindowShown, OnCandidateWindowShown) 747 IPC_MESSAGE_HANDLER(ViewMsg_CandidateWindowShown, OnCandidateWindowShown)
745 IPC_MESSAGE_HANDLER(ViewMsg_CandidateWindowUpdated, 748 IPC_MESSAGE_HANDLER(ViewMsg_CandidateWindowUpdated,
746 OnCandidateWindowUpdated) 749 OnCandidateWindowUpdated)
747 IPC_MESSAGE_HANDLER(ViewMsg_CandidateWindowHidden, OnCandidateWindowHidden) 750 IPC_MESSAGE_HANDLER(ViewMsg_CandidateWindowHidden, OnCandidateWindowHidden)
748 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) 751 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint)
749 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) 752 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection)
750 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) 753 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck)
751 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) 754 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects)
755 IPC_MESSAGE_HANDLER(ViewMsg_UpdateSurfaceIdNamespace,
756 OnUpdateSurfaceIdNamespace)
752 #if defined(OS_ANDROID) 757 #if defined(OS_ANDROID)
753 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) 758 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded)
754 IPC_MESSAGE_HANDLER(ViewMsg_ImeEventAck, OnImeEventAck) 759 IPC_MESSAGE_HANDLER(ViewMsg_ImeEventAck, OnImeEventAck)
755 #endif 760 #endif
756 IPC_MESSAGE_UNHANDLED(handled = false) 761 IPC_MESSAGE_UNHANDLED(handled = false)
757 IPC_END_MESSAGE_MAP() 762 IPC_END_MESSAGE_MAP()
758 return handled; 763 return handled;
759 } 764 }
760 765
761 bool RenderWidget::Send(IPC::Message* message) { 766 bool RenderWidget::Send(IPC::Message* message) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 // loops. 888 // loops.
884 RenderThread::Get()->GetTaskRunner()->PostNonNestableTask( 889 RenderThread::Get()->GetTaskRunner()->PostNonNestableTask(
885 FROM_HERE, base::Bind(&RenderWidget::Close, this)); 890 FROM_HERE, base::Bind(&RenderWidget::Close, this));
886 891
887 // Balances the AddRef taken when we called AddRoute. 892 // Balances the AddRef taken when we called AddRoute.
888 Release(); 893 Release();
889 } 894 }
890 895
891 // Got a response from the browser after the renderer decided to create a new 896 // Got a response from the browser after the renderer decided to create a new
892 // view. 897 // view.
893 void RenderWidget::OnCreatingNewAck() { 898 void RenderWidget::OnCreatingNewAck(uint32_t surface_id_namespace) {
894 DCHECK(routing_id_ != MSG_ROUTING_NONE); 899 DCHECK(routing_id_ != MSG_ROUTING_NONE);
895 900
896 CompleteInit(); 901 CompleteInit(surface_id_namespace);
897 } 902 }
898 903
899 void RenderWidget::OnResize(const ViewMsg_Resize_Params& params) { 904 void RenderWidget::OnResize(const ViewMsg_Resize_Params& params) {
900 if (resizing_mode_selector_->ShouldAbortOnResize(this, params)) 905 if (resizing_mode_selector_->ShouldAbortOnResize(this, params))
901 return; 906 return;
902 907
903 if (screen_metrics_emulator_) { 908 if (screen_metrics_emulator_) {
904 screen_metrics_emulator_->OnResizeMessage(params); 909 screen_metrics_emulator_->OnResizeMessage(params);
905 return; 910 return;
906 } 911 }
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 if (screen_metrics_emulator_) { 1747 if (screen_metrics_emulator_) {
1743 screen_metrics_emulator_->OnUpdateScreenRectsMessage( 1748 screen_metrics_emulator_->OnUpdateScreenRectsMessage(
1744 view_screen_rect, window_screen_rect); 1749 view_screen_rect, window_screen_rect);
1745 } else { 1750 } else {
1746 view_screen_rect_ = view_screen_rect; 1751 view_screen_rect_ = view_screen_rect;
1747 window_screen_rect_ = window_screen_rect; 1752 window_screen_rect_ = window_screen_rect;
1748 } 1753 }
1749 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id())); 1754 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id()));
1750 } 1755 }
1751 1756
1757 void RenderWidget::OnUpdateSurfaceIdNamespace(uint32 surface_id_namespace) {
1758 if (compositor_)
1759 compositor_->SetSurfaceIdNamespace(surface_id_namespace);
1760 }
1761
1752 void RenderWidget::showImeIfNeeded() { 1762 void RenderWidget::showImeIfNeeded() {
1753 OnShowImeIfNeeded(); 1763 OnShowImeIfNeeded();
1754 } 1764 }
1755 1765
1756 void RenderWidget::OnShowImeIfNeeded() { 1766 void RenderWidget::OnShowImeIfNeeded() {
1757 #if defined(OS_ANDROID) || defined(USE_AURA) 1767 #if defined(OS_ANDROID) || defined(USE_AURA)
1758 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); 1768 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME);
1759 #endif 1769 #endif
1760 1770
1761 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with 1771 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2450 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2441 video_hole_frames_.AddObserver(frame); 2451 video_hole_frames_.AddObserver(frame);
2442 } 2452 }
2443 2453
2444 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2454 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2445 video_hole_frames_.RemoveObserver(frame); 2455 video_hole_frames_.RemoveObserver(frame);
2446 } 2456 }
2447 #endif // defined(VIDEO_HOLE) 2457 #endif // defined(VIDEO_HOLE)
2448 2458
2449 } // namespace content 2459 } // namespace content
OLDNEW
« content/browser/compositor/delegated_frame_host.cc ('K') | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698