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

Side by Side Diff: Source/core/rendering/RenderWidget.cpp

Issue 15741010: Make WidgetHierarchyUpdatesSuspensionScope use swap instead of copy (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved.
5 * Copyright (C) 2013 Google Inc. All rights reserved. 5 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 unsigned WidgetHierarchyUpdatesSuspensionScope::s_widgetHierarchyUpdateSuspendCo unt = 0; 46 unsigned WidgetHierarchyUpdatesSuspensionScope::s_widgetHierarchyUpdateSuspendCo unt = 0;
47 47
48 WidgetHierarchyUpdatesSuspensionScope::WidgetToParentMap& WidgetHierarchyUpdates SuspensionScope::widgetNewParentMap() 48 WidgetHierarchyUpdatesSuspensionScope::WidgetToParentMap& WidgetHierarchyUpdates SuspensionScope::widgetNewParentMap()
49 { 49 {
50 DEFINE_STATIC_LOCAL(WidgetToParentMap, map, ()); 50 DEFINE_STATIC_LOCAL(WidgetToParentMap, map, ());
51 return map; 51 return map;
52 } 52 }
53 53
54 void WidgetHierarchyUpdatesSuspensionScope::moveWidgets() 54 void WidgetHierarchyUpdatesSuspensionScope::moveWidgets()
55 { 55 {
56 WidgetToParentMap map = widgetNewParentMap(); 56 WidgetToParentMap map;
57 widgetNewParentMap().clear(); 57 widgetNewParentMap().swap(map);
eseidel 2013/05/23 03:12:22 This extends the lifetime of widgets in this map t
dmichael (off chromium) 2013/05/23 15:52:58 Note how the old code copies the map in line 56. T
58 WidgetToParentMap::iterator end = map.end(); 58 WidgetToParentMap::iterator end = map.end();
59 for (WidgetToParentMap::iterator it = map.begin(); it != end; ++it) { 59 for (WidgetToParentMap::iterator it = map.begin(); it != end; ++it) {
60 Widget* child = it->key.get(); 60 Widget* child = it->key.get();
61 ScrollView* currentParent = child->parent(); 61 ScrollView* currentParent = child->parent();
62 FrameView* newParent = it->value; 62 FrameView* newParent = it->value;
63 if (newParent != currentParent) { 63 if (newParent != currentParent) {
64 if (currentParent) 64 if (currentParent)
65 currentParent->removeChild(child); 65 currentParent->removeChild(child);
66 if (newParent) 66 if (newParent)
67 newParent->addChild(child); 67 newParent->addChild(child);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor ) const 375 CursorDirective RenderWidget::getCursor(const LayoutPoint& point, Cursor& cursor ) const
376 { 376 {
377 if (widget() && widget()->isPluginView()) { 377 if (widget() && widget()->isPluginView()) {
378 // A plug-in is responsible for setting the cursor when the pointer is o ver it. 378 // A plug-in is responsible for setting the cursor when the pointer is o ver it.
379 return DoNotSetCursor; 379 return DoNotSetCursor;
380 } 380 }
381 return RenderReplaced::getCursor(point, cursor); 381 return RenderReplaced::getCursor(point, cursor);
382 } 382 }
383 383
384 } // namespace WebCore 384 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698