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

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

Issue 647613002: Fix RenderWidgetHostViewGuest leak. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add is_guest_view_hack_ to RWHV Created 6 years, 2 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/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/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 private: 422 private:
423 RenderWidgetHostViewAura* view_; 423 RenderWidgetHostViewAura* view_;
424 424
425 DISALLOW_COPY_AND_ASSIGN(WindowObserver); 425 DISALLOW_COPY_AND_ASSIGN(WindowObserver);
426 }; 426 };
427 427
428 //////////////////////////////////////////////////////////////////////////////// 428 ////////////////////////////////////////////////////////////////////////////////
429 // RenderWidgetHostViewAura, public: 429 // RenderWidgetHostViewAura, public:
430 430
431 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) 431 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host,
432 bool is_guest_view_hack)
432 : host_(RenderWidgetHostImpl::From(host)), 433 : host_(RenderWidgetHostImpl::From(host)),
433 window_(new aura::Window(this)), 434 window_(new aura::Window(this)),
434 delegated_frame_host_(new DelegatedFrameHost(this)), 435 delegated_frame_host_(new DelegatedFrameHost(this)),
435 in_shutdown_(false), 436 in_shutdown_(false),
436 in_bounds_changed_(false), 437 in_bounds_changed_(false),
437 is_fullscreen_(false), 438 is_fullscreen_(false),
438 popup_parent_host_view_(NULL), 439 popup_parent_host_view_(NULL),
439 popup_child_host_view_(NULL), 440 popup_child_host_view_(NULL),
440 is_loading_(false), 441 is_loading_(false),
441 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 442 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
442 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), 443 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
443 can_compose_inline_(true), 444 can_compose_inline_(true),
444 has_composition_text_(false), 445 has_composition_text_(false),
445 accept_return_character_(false), 446 accept_return_character_(false),
446 last_swapped_software_frame_scale_factor_(1.f), 447 last_swapped_software_frame_scale_factor_(1.f),
447 paint_canvas_(NULL), 448 paint_canvas_(NULL),
448 synthetic_move_sent_(false), 449 synthetic_move_sent_(false),
449 cursor_visibility_state_in_renderer_(UNKNOWN), 450 cursor_visibility_state_in_renderer_(UNKNOWN),
450 #if defined(OS_WIN) 451 #if defined(OS_WIN)
451 legacy_render_widget_host_HWND_(NULL), 452 legacy_render_widget_host_HWND_(NULL),
452 legacy_window_destroyed_(false), 453 legacy_window_destroyed_(false),
453 #endif 454 #endif
454 has_snapped_to_boundary_(false), 455 has_snapped_to_boundary_(false),
455 touch_editing_client_(NULL), 456 touch_editing_client_(NULL),
457 is_guest_view_hack_(is_guest_view_hack),
456 weak_ptr_factory_(this) { 458 weak_ptr_factory_(this) {
457 host_->SetView(this); 459 if (!is_guest_view_hack_)
460 host_->SetView(this);
461
458 window_observer_.reset(new WindowObserver(this)); 462 window_observer_.reset(new WindowObserver(this));
459 aura::client::SetTooltipText(window_, &tooltip_); 463 aura::client::SetTooltipText(window_, &tooltip_);
460 aura::client::SetActivationDelegate(window_, this); 464 aura::client::SetActivationDelegate(window_, this);
461 aura::client::SetActivationChangeObserver(window_, this); 465 aura::client::SetActivationChangeObserver(window_, this);
462 aura::client::SetFocusChangeObserver(window_, this); 466 aura::client::SetFocusChangeObserver(window_, this);
463 window_->set_layer_owner_delegate(delegated_frame_host_.get()); 467 window_->set_layer_owner_delegate(delegated_frame_host_.get());
464 gfx::Screen::GetScreenFor(window_)->AddObserver(this); 468 gfx::Screen::GetScreenFor(window_)->AddObserver(this);
465 469
466 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> 470 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()->
467 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; 471 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0";
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 // to the input method). 1742 // to the input method).
1739 ui::InputMethod* input_method = GetInputMethod(); 1743 ui::InputMethod* input_method = GetInputMethod();
1740 if (input_method) 1744 if (input_method)
1741 input_method->DetachTextInputClient(this); 1745 input_method->DetachTextInputClient(this);
1742 1746
1743 if (overscroll_controller_) 1747 if (overscroll_controller_)
1744 overscroll_controller_->Reset(); 1748 overscroll_controller_->Reset();
1745 } 1749 }
1746 1750
1747 void RenderWidgetHostViewAura::OnWindowDestroyed(aura::Window* window) { 1751 void RenderWidgetHostViewAura::OnWindowDestroyed(aura::Window* window) {
1748 host_->ViewDestroyed(); 1752 // Ask the RWH to drop reference to us.
1753 if (!is_guest_view_hack_)
1754 host_->ViewDestroyed();
1755
1749 delete this; 1756 delete this;
1750 } 1757 }
1751 1758
1752 void RenderWidgetHostViewAura::OnWindowTargetVisibilityChanged(bool visible) { 1759 void RenderWidgetHostViewAura::OnWindowTargetVisibilityChanged(bool visible) {
1753 } 1760 }
1754 1761
1755 bool RenderWidgetHostViewAura::HasHitTestMask() const { 1762 bool RenderWidgetHostViewAura::HasHitTestMask() const {
1756 return false; 1763 return false;
1757 } 1764 }
1758 1765
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 2586
2580 //////////////////////////////////////////////////////////////////////////////// 2587 ////////////////////////////////////////////////////////////////////////////////
2581 // RenderWidgetHostViewBase, public: 2588 // RenderWidgetHostViewBase, public:
2582 2589
2583 // static 2590 // static
2584 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2591 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2585 GetScreenInfoForWindow(results, NULL); 2592 GetScreenInfoForWindow(results, NULL);
2586 } 2593 }
2587 2594
2588 } // namespace content 2595 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698