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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 134103006: linux_aura: Fix cursor memeory leak, which was redding the lsan bot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "ui/aura/client/activation_client.h" 9 #include "ui/aura/client/activation_client.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 private: 204 private:
205 DesktopNativeWidgetAura* desktop_native_widget_aura_; 205 DesktopNativeWidgetAura* desktop_native_widget_aura_;
206 206
207 DISALLOW_COPY_AND_ASSIGN(FocusManagerEventHandler); 207 DISALLOW_COPY_AND_ASSIGN(FocusManagerEventHandler);
208 }; 208 };
209 209
210 //////////////////////////////////////////////////////////////////////////////// 210 ////////////////////////////////////////////////////////////////////////////////
211 // DesktopNativeWidgetAura, public: 211 // DesktopNativeWidgetAura, public:
212 212
213 DesktopNativeCursorManager* DesktopNativeWidgetAura::native_cursor_manager_ = 213 DesktopNativeCursorManager* DesktopNativeWidgetAura::native_cursor_manager_ =
tdanderson 2014/01/14 17:42:27 |native_cursor_manager_| is OK to leave as a raw p
214 NULL; 214 NULL;
215 views::corewm::CursorManager* DesktopNativeWidgetAura::cursor_manager_ = NULL; 215 base::LazyInstance<scoped_ptr<views::corewm::CursorManager> >
216 DesktopNativeWidgetAura::cursor_manager_ = LAZY_INSTANCE_INITIALIZER;
216 217
217 DesktopNativeWidgetAura::DesktopNativeWidgetAura( 218 DesktopNativeWidgetAura::DesktopNativeWidgetAura(
218 internal::NativeWidgetDelegate* delegate) 219 internal::NativeWidgetDelegate* delegate)
219 : ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 220 : ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
220 close_widget_factory_(this), 221 close_widget_factory_(this),
221 can_activate_(true), 222 can_activate_(true),
222 desktop_root_window_host_(NULL), 223 desktop_root_window_host_(NULL),
223 content_window_container_(NULL), 224 content_window_container_(NULL),
224 content_window_(new aura::Window(this)), 225 content_window_(new aura::Window(this)),
225 native_widget_delegate_(delegate), 226 native_widget_delegate_(delegate),
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 root_window_event_filter_ = new corewm::CompoundEventFilter; 395 root_window_event_filter_ = new corewm::CompoundEventFilter;
395 // Pass ownership of the filter to the root_window. 396 // Pass ownership of the filter to the root_window.
396 root_window_->window()->SetEventFilter(root_window_event_filter_); 397 root_window_->window()->SetEventFilter(root_window_event_filter_);
397 398
398 // |root_window_| must be added to |native_cursor_manager_| before 399 // |root_window_| must be added to |native_cursor_manager_| before
399 // OnRootWindowCreated() is called. 400 // OnRootWindowCreated() is called.
400 if (!native_cursor_manager_) { 401 if (!native_cursor_manager_) {
401 native_cursor_manager_ = new DesktopNativeCursorManager( 402 native_cursor_manager_ = new DesktopNativeCursorManager(
402 DesktopCursorLoaderUpdater::Create()); 403 DesktopCursorLoaderUpdater::Create());
403 } 404 }
404 if (!cursor_manager_) { 405 if (!cursor_manager_.Get()) {
405 cursor_manager_ = new views::corewm::CursorManager( 406 cursor_manager_.Get().reset(new views::corewm::CursorManager(
406 scoped_ptr<corewm::NativeCursorManager>(native_cursor_manager_)); 407 scoped_ptr<corewm::NativeCursorManager>(native_cursor_manager_)));
407 } 408 }
408 native_cursor_manager_->AddRootWindow(root_window_.get()); 409 native_cursor_manager_->AddRootWindow(root_window_.get());
409 aura::client::SetCursorClient(root_window_->window(), cursor_manager_); 410 aura::client::SetCursorClient(root_window_->window(),
411 cursor_manager_.Get().get());
410 412
411 desktop_root_window_host_->OnRootWindowCreated(root_window_.get(), params); 413 desktop_root_window_host_->OnRootWindowCreated(root_window_.get(), params);
412 414
413 UpdateWindowTransparency(); 415 UpdateWindowTransparency();
414 416
415 capture_client_.reset(new DesktopCaptureClient(root_window_->window())); 417 capture_client_.reset(new DesktopCaptureClient(root_window_->window()));
416 418
417 corewm::FocusController* focus_controller = 419 corewm::FocusController* focus_controller =
418 new corewm::FocusController(new DesktopFocusRules(content_window_)); 420 new corewm::FocusController(new DesktopFocusRules(content_window_));
419 focus_client_.reset(focus_controller); 421 focus_client_.reset(focus_controller);
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 input_method_event_filter_->SetInputMethodPropertyInRootWindow( 1124 input_method_event_filter_->SetInputMethodPropertyInRootWindow(
1123 root_window_->window()); 1125 root_window_->window());
1124 root_window_event_filter_->AddHandler(input_method_event_filter_.get()); 1126 root_window_event_filter_->AddHandler(input_method_event_filter_.get());
1125 } 1127 }
1126 1128
1127 void DesktopNativeWidgetAura::UpdateWindowTransparency() { 1129 void DesktopNativeWidgetAura::UpdateWindowTransparency() {
1128 content_window_->SetTransparent(ShouldUseNativeFrame()); 1130 content_window_->SetTransparent(ShouldUseNativeFrame());
1129 } 1131 }
1130 1132
1131 } // namespace views 1133 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698