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

Unified Diff: chrome/renderer/chrome_render_process_observer.cc

Issue 8523037: base::Bind migrations in chrome/renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
« no previous file with comments | « no previous file | chrome/renderer/chrome_render_view_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/chrome_render_process_observer.cc
===================================================================
--- chrome/renderer/chrome_render_process_observer.cc (revision 110185)
+++ chrome/renderer/chrome_render_process_observer.cc (working copy)
@@ -4,9 +4,11 @@
#include "chrome/renderer/chrome_render_process_observer.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/message_loop.h"
+#include "base/memory/weak_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/native_library.h"
@@ -59,7 +61,7 @@
class RendererResourceDelegate : public content::ResourceDispatcherDelegate {
public:
RendererResourceDelegate()
- : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
}
virtual webkit_glue::ResourceLoaderBridge::Peer* OnRequestComplete(
@@ -68,11 +70,11 @@
const net::URLRequestStatus& status) {
// Update the browser about our cache.
// Rate limit informing the host of our cache stats.
- if (method_factory_.empty()) {
+ if (!weak_factory_.HasWeakPtrs()) {
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
- method_factory_.NewRunnableMethod(
- &RendererResourceDelegate::InformHostOfCacheStats),
+ base::Bind(&RendererResourceDelegate::InformHostOfCacheStats,
+ weak_factory_.GetWeakPtr()),
kCacheStatsDelayMS);
}
@@ -101,7 +103,7 @@
RenderThread::Get()->Send(new ChromeViewHostMsg_UpdatedCacheStats(stats));
}
- ScopedRunnableMethodFactory<RendererResourceDelegate> method_factory_;
+ base::WeakPtrFactory<RendererResourceDelegate> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(RendererResourceDelegate);
};
« no previous file with comments | « no previous file | chrome/renderer/chrome_render_view_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698