diff options
-rw-r--r-- | chrome/browser/chromeos/boot_times_loader.cc | 14 | ||||
-rw-r--r-- | chrome/browser/instant/instant_loader.cc | 14 | ||||
-rw-r--r-- | chrome/browser/sessions/session_restore.cc | 15 | ||||
-rw-r--r-- | chrome/browser/tab_render_watcher.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/new_tab_ui.cc | 10 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_impl.cc | 10 | ||||
-rw-r--r-- | content/public/browser/notification_types.h | 6 |
7 files changed, 43 insertions, 30 deletions
diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index 7df1807..508ba201 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -359,8 +359,10 @@ void BootTimesLoader::LoginDone() { content::NotificationService::AllSources()); registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::NotificationService::AllSources()); - registrar_.Remove(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, - content::NotificationService::AllSources()); + registrar_.Remove( + this, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, + content::NotificationService::AllSources()); // Don't swamp the FILE thread right away. BrowserThread::PostDelayedTask( BrowserThread::FILE, FROM_HERE, @@ -424,8 +426,10 @@ void BootTimesLoader::RecordLoginAttempted() { content::NotificationService::AllSources()); registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::NotificationService::AllSources()); - registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, - content::NotificationService::AllSources()); + registrar_.Add( + this, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, + content::NotificationService::AllSources()); } } @@ -495,7 +499,7 @@ void BootTimesLoader::Observe( } break; } - case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: { + case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE: { RenderWidgetHost* rwh = content::Source<RenderWidgetHost>(source).ptr(); if (render_widget_hosts_loading_.find(rwh) != render_widget_hosts_loading_.end()) { diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 9cd55d3..a3667bb 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -400,8 +400,10 @@ void InstantLoader::TabContentsDelegateImpl::RegisterForPaintNotifications( registered_render_widget_host_ = render_widget_host; content::Source<RenderWidgetHost> source = content::Source<RenderWidgetHost>(registered_render_widget_host_); - registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, - source); + registrar_.Add( + this, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, + source); registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, source); } @@ -410,8 +412,10 @@ void InstantLoader::TabContentsDelegateImpl::UnregisterForPaintNotifications() { if (registered_render_widget_host_) { content::Source<RenderWidgetHost> source = content::Source<RenderWidgetHost>(registered_render_widget_host_); - registrar_.Remove(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, - source); + registrar_.Remove( + this, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, + source); registrar_.Remove(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, source); registered_render_widget_host_ = NULL; @@ -423,7 +427,7 @@ void InstantLoader::TabContentsDelegateImpl::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { - case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: + case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE: UnregisterForPaintNotifications(); PreviewPainted(); break; diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index eaf36c0..465bbfd 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -219,8 +219,10 @@ void TabLoader::StartLoading() { // eventually. if (loading_) return; - registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, - content::NotificationService::AllSources()); + registrar_.Add( + this, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, + content::NotificationService::AllSources()); this_retainer_ = this; #if defined(OS_CHROMEOS) if (!net::NetworkChangeNotifier::IsOffline()) { @@ -318,10 +320,11 @@ void TabLoader::Observe(int type, HandleTabClosedOrLoaded(tab); break; } - case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: { - if (!got_first_paint_) { - RenderWidgetHost* render_widget_host = - content::Source<RenderWidgetHost>(source).ptr(); + case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE: { + RenderWidgetHost* render_widget_host = + content::Source<RenderWidgetHost>(source).ptr(); + if (!got_first_paint_ && render_widget_host->GetView() && + render_widget_host->GetView()->IsShowing()) { if (render_widget_hosts_to_paint_.find(render_widget_host) != render_widget_hosts_to_paint_.end()) { // Got a paint for one of our renderers, so record time. diff --git a/chrome/browser/tab_render_watcher.cc b/chrome/browser/tab_render_watcher.cc index 160199f..f11a1c9 100644 --- a/chrome/browser/tab_render_watcher.cc +++ b/chrome/browser/tab_render_watcher.cc @@ -32,7 +32,7 @@ void TabRenderWatcher::Observe(int type, case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { RenderWidgetHost* rwh = content::Details<RenderWidgetHost>(details).ptr(); registrar_.Add(this, - content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, content::Source<RenderWidgetHost>(rwh)); delegate_->OnRenderHostCreated( content::Details<content::RenderViewHost>(details).ptr()); @@ -44,7 +44,7 @@ void TabRenderWatcher::Observe(int type, delegate_->OnTabMainFrameLoaded(); } break; - case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: + case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE: if (loaded_) delegate_->OnTabMainFrameRender(); break; diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc index 1a4f5e8..ef71746 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc @@ -198,10 +198,12 @@ void NewTabUI::StartTimingPaint(RenderViewHost* render_view_host) { content::NotificationSource source = content::Source<content::RenderWidgetHost>(render_view_host); if (!registrar_.IsRegistered(this, - content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, source)) { - registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, - source); + registrar_.Add( + this, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, + source); } timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kTimeoutMs), this, @@ -245,7 +247,7 @@ void NewTabUI::Observe(int type, break; } #endif - case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: { + case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE: { last_paint_ = base::TimeTicks::Now(); break; } diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 668b75b..5cc4cf5 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -1355,6 +1355,11 @@ void RenderWidgetHostImpl::DidUpdateBackingStore( if (view_) view_->MovePluginWindows(params.plugin_window_moves); + NotificationService::current()->Notify( + NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, + Source<RenderWidgetHost>(this), + NotificationService::NoDetails()); + // We don't need to update the view if the view is hidden. We must do this // early return after the ACK is sent, however, or the renderer will not send // us more data. @@ -1369,11 +1374,6 @@ void RenderWidgetHostImpl::DidUpdateBackingStore( view_being_painted_ = false; } - NotificationService::current()->Notify( - NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, - Source<RenderWidgetHost>(this), - NotificationService::NoDetails()); - // If we got a resize ack, then perhaps we have another resize to send? bool is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); diff --git a/content/public/browser/notification_types.h b/content/public/browser/notification_types.h index 6d9c080..9c4a835 100644 --- a/content/public/browser/notification_types.h +++ b/content/public/browser/notification_types.h @@ -276,9 +276,9 @@ enum NotificationType { // the RenderWidgetHost, the details are not used. NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, - // Sent after the widget has painted. The source is the RenderWidgetHost, - // the details are not used. - NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, + // Sent after the backing store has been updated but before the widget has + // painted. The source is the RenderWidgetHost, the details are not used. + NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, // This notifies the observer that a PaintAtSizeACK was received. The source // is the RenderWidgetHost, the details are an instance of |