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

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_views.cc

Issue 8568030: base::Bind() conversion in renderer_host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing #include for Mac Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/render_widget_host_view_views.cc
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc
index 550e1764b6fc31cb46adfe9688f69bee43c95699..3a4a9f58e5ae32e922c6e3032b3ef88f485eabe3 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_views.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc
@@ -7,12 +7,12 @@
#include <algorithm>
#include <string>
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
-#include "base/task.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_notification_types.h"
@@ -122,7 +122,7 @@ RenderWidgetHostViewViews::RenderWidgetHostViewViews(RenderWidgetHost* host)
has_composition_text_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(touch_selection_controller_(
views::TouchSelectionController::create(this))),
- ALLOW_THIS_IN_INITIALIZER_LIST(update_touch_selection_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
set_focusable(true);
host_->SetView(this);
@@ -200,8 +200,7 @@ void RenderWidgetHostViewViews::WasHidden() {
if (host_)
host_->WasHidden();
- if (!update_touch_selection_.empty())
- update_touch_selection_.RevokeAll();
+ weak_factory_.InvalidateWeakPtrs();
}
void RenderWidgetHostViewViews::SetSize(const gfx::Size& size) {
@@ -411,10 +410,11 @@ void RenderWidgetHostViewViews::SelectionBoundsChanged(
// inserting text at the beginning of a non-empty text control). But in those
// cases, it does send the correct selection information quickly afterwards.
// So delay the notification to the touch-selection controller.
- if (update_touch_selection_.empty()) {
+ if (!weak_factory_.HasWeakPtrs()) {
MessageLoop::current()->PostDelayedTask(FROM_HERE,
- update_touch_selection_.NewRunnableMethod(
- &RenderWidgetHostViewViews::UpdateTouchSelectionController),
+ base::Bind(
+ &RenderWidgetHostViewViews::UpdateTouchSelectionController,
+ weak_factory_.GetWeakPtr()),
kTouchControllerUpdateDelay);
}
}
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_views.h ('k') | chrome/browser/renderer_host/web_cache_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698