Index: chrome/browser/chrome_content_browser_client.cc |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
index aa0fee8c2f08847b4a5645c8e42ef9096e57355b..7f78984bc5529182edccfc7d7739c791512e78f3 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -38,6 +38,7 @@ |
#include "chrome/browser/browsing_data/browsing_data_remover.h" |
#include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
#include "chrome/browser/budget_service/budget_service_impl.h" |
+#include "chrome/browser/cache_stats_recorder.h" |
#include "chrome/browser/chrome_content_browser_client_parts.h" |
#include "chrome/browser/chrome_quota_permission_context.h" |
#include "chrome/browser/content_settings/cookie_settings_factory.h" |
@@ -3053,6 +3054,14 @@ bool ChromeContentBrowserClient::PreSpawnRenderer( |
void ChromeContentBrowserClient::ExposeInterfacesToRenderer( |
service_manager::InterfaceRegistry* registry, |
content::RenderProcessHost* render_process_host) { |
+ // The CacheStatsRecorder is an associated binding, instead of a |
+ // non-associated one, because the sender (in the renderer process) posts the |
+ // message after a time delay, in order to rate limit. The association |
+ // protects against the render process host ID being recycled in that time |
+ // gap between the preparation and the execution of that IPC. |
+ render_process_host->GetChannel()->AddAssociatedInterfaceForIOThread( |
+ base::Bind(&CacheStatsRecorder::Create, render_process_host->GetID())); |
+ |
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = |
content::BrowserThread::GetTaskRunnerForThread( |
content::BrowserThread::UI); |