diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 23:06:02 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 23:06:02 +0000 |
commit | 6cf19311fbe08c5c8c674a50fd834ae818b549c0 (patch) | |
tree | 3695140186636fea207811b46160cbef6d985ac2 | |
parent | 6c93e3656f1d01e24908c8c8cd07e6c2d53bb05c (diff) | |
download | chromium_src-6cf19311fbe08c5c8c674a50fd834ae818b549c0.zip chromium_src-6cf19311fbe08c5c8c674a50fd834ae818b549c0.tar.gz chromium_src-6cf19311fbe08c5c8c674a50fd834ae818b549c0.tar.bz2 |
Remove the rest of the Chrome dependencies from RenderThread.
Review URL: http://codereview.chromium.org/6853029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81666 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 20 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.h | 5 | ||||
-rw-r--r-- | chrome/renderer/net/renderer_net_predictor.cc | 6 | ||||
-rw-r--r-- | chrome/renderer/net/renderer_net_predictor.h | 4 | ||||
-rw-r--r-- | chrome/renderer/page_load_histograms.cc | 50 | ||||
-rw-r--r-- | chrome/renderer/page_load_histograms.h | 27 | ||||
-rw-r--r-- | chrome/renderer/render_thread.cc | 25 | ||||
-rw-r--r-- | chrome/renderer/render_thread.h | 11 | ||||
-rw-r--r-- | chrome/renderer/renderer_glue.cc | 11 | ||||
-rw-r--r-- | chrome/renderer/renderer_histogram_snapshots.cc | 14 | ||||
-rw-r--r-- | chrome/renderer/renderer_histogram_snapshots.h | 9 | ||||
-rw-r--r-- | content/renderer/content_renderer_client.cc | 4 | ||||
-rw-r--r-- | content/renderer/content_renderer_client.h | 1 | ||||
-rw-r--r-- | content/renderer/render_view.cc | 16 | ||||
-rw-r--r-- | content/renderer/render_view.h | 4 | ||||
-rw-r--r-- | content/renderer/render_view_observer.h | 7 | ||||
-rw-r--r-- | content/renderer/renderer_webkitclient_impl.cc | 12 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 5 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 2 |
19 files changed, 128 insertions, 105 deletions
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 0e3204d..47d633c 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -22,6 +22,7 @@ #include "chrome/renderer/autofill/form_manager.h" #include "chrome/renderer/autofill/password_autofill_manager.h" #include "chrome/renderer/automation/automation_renderer_helper.h" +#include "chrome/renderer/automation/dom_automation_v8_extension.h" #include "chrome/renderer/blocked_plugin.h" #include "chrome/renderer/chrome_render_observer.h" #include "chrome/renderer/devtools_agent.h" @@ -34,10 +35,14 @@ #include "chrome/renderer/extensions/extension_resource_request_policy.h" #include "chrome/renderer/extensions/renderer_extension_bindings.h" #include "chrome/renderer/external_extension.h" +#include "chrome/renderer/loadtimes_extension_bindings.h" #include "chrome/renderer/localized_error.h" +#include "chrome/renderer/net/renderer_net_predictor.h" #include "chrome/renderer/page_click_tracker.h" +#include "chrome/renderer/page_load_histograms.h" #include "chrome/renderer/print_web_view_helper.h" #include "chrome/renderer/render_thread.h" +#include "chrome/renderer/renderer_histogram_snapshots.h" #include "chrome/renderer/safe_browsing/malware_dom_details.h" #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" #include "chrome/renderer/search_extension.h" @@ -211,6 +216,8 @@ ChromeContentRendererClient::~ChromeContentRendererClient() { void ChromeContentRendererClient::RenderThreadStarted() { extension_dispatcher_.reset(new ExtensionDispatcher()); + histogram_snapshots_.reset(new RendererHistogramSnapshots()); + net_predictor_.reset(new RendererNetPredictor()); spellcheck_.reset(new SpellCheck()); visited_link_slave_.reset(new VisitedLinkSlave()); phishing_classifier_.reset(new safe_browsing::PhishingClassifierFilter); @@ -222,17 +229,24 @@ void ChromeContentRendererClient::RenderThreadStarted() { #endif thread->AddObserver(extension_dispatcher_.get()); + thread->AddObserver(histogram_snapshots_.get()); thread->AddObserver(phishing_classifier_.get()); thread->AddObserver(spellcheck_.get()); thread->AddObserver(visited_link_slave_.get()); thread->RegisterExtension(extensions_v8::ExternalExtension::Get()); + thread->RegisterExtension(extensions_v8::LoadTimesExtension::Get()); thread->RegisterExtension(extensions_v8::SearchBoxExtension::Get()); v8::Extension* search_extension = extensions_v8::SearchExtension::Get(); // search_extension is null if not enabled. if (search_extension) thread->RegisterExtension(search_extension); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDomAutomationController)) { + thread->RegisterExtension(DomAutomationV8Extension::Get()); + } + thread->resource_dispatcher()->set_observer(new RenderResourceObserver()); } @@ -248,6 +262,7 @@ void ChromeContentRendererClient::RenderViewCreated(RenderView* render_view) { new DevToolsAgent(render_view); new ExtensionHelper(render_view, extension_dispatcher_.get()); + new PageLoadHistograms(render_view, histogram_snapshots_.get()); new PrintWebViewHelper(render_view); new SearchBox(render_view); new SpellCheckProvider(render_view, spellcheck_.get()); @@ -554,6 +569,11 @@ bool ChromeContentRendererClient::IsLinkVisited(unsigned long long link_hash) { return visited_link_slave_->IsVisited(link_hash); } +void ChromeContentRendererClient::PrefetchHostName(const char* hostname, + size_t length) { + net_predictor_->Resolve(hostname, length); +} + void ChromeContentRendererClient::SetExtensionDispatcher( ExtensionDispatcher* extension_dispatcher) { extension_dispatcher_.reset(extension_dispatcher); diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h index e56204b..33cf2b6 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h @@ -10,6 +10,8 @@ #include "content/renderer/content_renderer_client.h" class ExtensionDispatcher; +class RendererHistogramSnapshots; +class RendererNetPredictor; class SpellCheck; class VisitedLinkSlave; @@ -57,6 +59,7 @@ class ChromeContentRendererClient : public content::ContentRendererClient { virtual unsigned long long VisitedLinkHash(const char* canonical_url, size_t length); virtual bool IsLinkVisited(unsigned long long link_hash); + virtual void PrefetchHostName(const char* hostname, size_t length); // For testing. void SetExtensionDispatcher(ExtensionDispatcher* extension_dispatcher); @@ -82,6 +85,8 @@ class ChromeContentRendererClient : public content::ContentRendererClient { bool CrossesExtensionExtents(WebKit::WebFrame* frame, const GURL& new_url); scoped_ptr<ExtensionDispatcher> extension_dispatcher_; + scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_; + scoped_ptr<RendererNetPredictor> net_predictor_; scoped_ptr<SpellCheck> spellcheck_; scoped_ptr<VisitedLinkSlave> visited_link_slave_; scoped_ptr<safe_browsing::PhishingClassifierFilter> phishing_classifier_; diff --git a/chrome/renderer/net/renderer_net_predictor.cc b/chrome/renderer/net/renderer_net_predictor.cc index 7f9a7f1..b32608a 100644 --- a/chrome/renderer/net/renderer_net_predictor.cc +++ b/chrome/renderer/net/renderer_net_predictor.cc @@ -16,12 +16,6 @@ #include "chrome/renderer/net/predictor_queue.h" #include "chrome/renderer/render_thread.h" -// This API is used in the render process by renderer_glue.cc. -// IF you are in the render process, you MUST be on the renderer thread to call. -void DnsPrefetchCString(const char* hostname, size_t length) { - RenderThread::current()->Resolve(hostname, length); -} - // The number of hostnames submitted to Browser DNS resolver per call to // SubmitHostsnames() (which reads names from our queue). static const size_t kMAX_SUBMISSION_PER_TASK = 30; diff --git a/chrome/renderer/net/renderer_net_predictor.h b/chrome/renderer/net/renderer_net_predictor.h index b761763..2b5d4c6 100644 --- a/chrome/renderer/net/renderer_net_predictor.h +++ b/chrome/renderer/net/renderer_net_predictor.h @@ -29,10 +29,6 @@ #include "base/task.h" #include "chrome/renderer/net/predictor_queue.h" -// Global API consists to do Prefetching in renderer. This uses IPC to reach -// the Browser's global functions. -void DnsPrefetchCString(const char* hostname, size_t length); - class RendererNetPredictor { public: RendererNetPredictor(); diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc index 97edd58..7922e48 100644 --- a/chrome/renderer/page_load_histograms.cc +++ b/chrome/renderer/page_load_histograms.cc @@ -9,17 +9,21 @@ #include "base/metrics/histogram.h" #include "base/time.h" #include "chrome/common/chrome_constants.h" -#include "chrome/renderer/render_thread.h" +#include "chrome/renderer/renderer_histogram_snapshots.h" +#include "content/common/view_messages.h" #include "content/renderer/navigation_state.h" +#include "content/renderer/render_view.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPerformance.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" using base::Time; using base::TimeDelta; using WebKit::WebDataSource; using WebKit::WebFrame; using WebKit::WebPerformance; +using WebKit::WebString; static const TimeDelta kPLTMin(TimeDelta::FromMilliseconds(10)); static const TimeDelta kPLTMax(TimeDelta::FromMinutes(10)); @@ -128,9 +132,12 @@ enum AbandonType { ABANDON_TYPE_MAX = 0x10 }; -PageLoadHistograms::PageLoadHistograms() - : cross_origin_access_count_(0), - same_origin_access_count_(0) { +PageLoadHistograms::PageLoadHistograms( + RenderView* render_view, RendererHistogramSnapshots* histogram_snapshots) + : RenderViewObserver(render_view), + cross_origin_access_count_(0), + same_origin_access_count_(0), + histogram_snapshots_(histogram_snapshots) { } void PageLoadHistograms::Dump(WebFrame* frame) { @@ -840,22 +847,41 @@ void PageLoadHistograms::Dump(WebFrame* frame) { // TODO(jar) BUG=33233: This needs to be moved to a PostDelayedTask, and it // should post when the onload is complete, so that it doesn't interfere with // the next load. - if (RenderThread::current()) { - RenderThread::current()->SendHistograms( - chrome::kHistogramSynchronizerReservedSequenceNumber); - } + histogram_snapshots_->SendHistograms( + chrome::kHistogramSynchronizerReservedSequenceNumber); +} + +void PageLoadHistograms::ResetCrossFramePropertyAccess() { + cross_origin_access_count_ = 0; + same_origin_access_count_ = 0; } -void PageLoadHistograms::IncrementCrossFramePropertyAccess(bool cross_origin) { +void PageLoadHistograms::FrameWillClose(WebFrame* frame) { + Dump(frame); +} + +void PageLoadHistograms::LogCrossFramePropertyAccess( + WebFrame* frame, + WebFrame* target, + bool cross_origin, + const WebString& property_name, + unsigned long long event_id) { + // TODO(johnnyg): track the individual properties and repeat event_ids. if (cross_origin) cross_origin_access_count_++; else same_origin_access_count_++; } -void PageLoadHistograms::ResetCrossFramePropertyAccess() { - cross_origin_access_count_ = 0; - same_origin_access_count_ = 0; +bool PageLoadHistograms::OnMessageReceived(const IPC::Message& message) { + if (message.type() == ViewMsg_ClosePage::ID) { + // TODO(davemoore) This code should be removed once willClose() gets + // called when a page is destroyed. page_load_histograms_.Dump() is safe + // to call multiple times for the same frame, but it will simplify things. + Dump(render_view()->webview()->mainFrame()); + ResetCrossFramePropertyAccess(); + } + return false; } void PageLoadHistograms::LogPageLoadTime(const NavigationState* state, diff --git a/chrome/renderer/page_load_histograms.h b/chrome/renderer/page_load_histograms.h index c89e3ac..35cf1df 100644 --- a/chrome/renderer/page_load_histograms.h +++ b/chrome/renderer/page_load_histograms.h @@ -6,17 +6,26 @@ #define CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ #include "base/basictypes.h" +#include "content/renderer/render_view_observer.h" class NavigationState; +class RendererHistogramSnapshots; -namespace WebKit { -class WebDataSource; -class WebFrame; -} - -class PageLoadHistograms { +class PageLoadHistograms : public RenderViewObserver { public: - PageLoadHistograms(); + PageLoadHistograms(RenderView* render_view, + RendererHistogramSnapshots* histogram_snapshots); + + private: + // RenderViewObserver implementation. + virtual void FrameWillClose(WebKit::WebFrame* frame); + virtual void LogCrossFramePropertyAccess( + WebKit::WebFrame* frame, + WebKit::WebFrame* target, + bool cross_origin, + const WebKit::WebString& property_name, + unsigned long long event_id); + virtual bool OnMessageReceived(const IPC::Message& message); // Dump all page load histograms appropriate for the given frame. // @@ -39,10 +48,8 @@ class PageLoadHistograms { // so first_paint and first_paint_after_load can be 0. void Dump(WebKit::WebFrame* frame); - void IncrementCrossFramePropertyAccess(bool cross_origin); void ResetCrossFramePropertyAccess(); - private: void LogPageLoadTime(const NavigationState* state, const WebKit::WebDataSource* ds) const; @@ -51,6 +58,8 @@ class PageLoadHistograms { int cross_origin_access_count_; int same_origin_access_count_; + RendererHistogramSnapshots* histogram_snapshots_; + DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); }; diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index c22cd8b..16ad7d5 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -14,6 +14,7 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" #include "base/metrics/stats_table.h" #include "base/process_util.h" #include "base/shared_memory.h" @@ -26,11 +27,7 @@ #include "chrome/common/render_messages.h" #include "chrome/common/safe_browsing/safebrowsing_messages.h" #include "chrome/common/url_constants.h" -#include "chrome/renderer/automation/dom_automation_v8_extension.h" -#include "chrome/renderer/loadtimes_extension_bindings.h" -#include "chrome/renderer/net/renderer_net_predictor.h" #include "chrome/renderer/render_process_impl.h" -#include "chrome/renderer/renderer_histogram_snapshots.h" #include "content/common/appcache/appcache_dispatcher.h" #include "content/common/database_messages.h" #include "content/common/db_message_filter.h" @@ -201,8 +198,6 @@ void RenderThread::Init() { idle_notification_delay_in_s_ = kInitialIdleHandlerDelayS; task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this)); - renderer_net_predictor_.reset(new RendererNetPredictor()); - histogram_snapshots_.reset(new RendererHistogramSnapshots()); appcache_dispatcher_.reset(new AppCacheDispatcher(this)); indexed_db_dispatcher_.reset(new IndexedDBDispatcher()); @@ -427,14 +422,6 @@ void RenderThread::DoNotNotifyWebKitOfModalLoop() { notify_webkit_of_modal_loop_ = false; } -void RenderThread::Resolve(const char* name, size_t length) { - return renderer_net_predictor_->Resolve(name, length); -} - -void RenderThread::SendHistograms(int sequence_number) { - return histogram_snapshots_->SendHistograms(sequence_number); -} - void RenderThread::OnSetContentSettingsForCurrentURL( const GURL& url, const ContentSettings& content_settings) { @@ -485,7 +472,6 @@ bool RenderThread::OnControlMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) IPC_MESSAGE_HANDLER(ViewMsg_SetCacheCapacities, OnSetCacheCapacities) IPC_MESSAGE_HANDLER(ViewMsg_ClearCache, OnClearCache) - IPC_MESSAGE_HANDLER(ViewMsg_GetRendererHistograms, OnGetRendererHistograms) #if defined(USE_TCMALLOC) IPC_MESSAGE_HANDLER(ViewMsg_GetRendererTcmalloc, OnGetRendererTcmalloc) #endif @@ -562,10 +548,6 @@ void RenderThread::OnGetCacheResourceStats() { Send(new ViewHostMsg_ResourceTypeStats(stats)); } -void RenderThread::OnGetRendererHistograms(int sequence_number) { - SendHistograms(sequence_number); -} - #if defined(USE_TCMALLOC) void RenderThread::OnGetRendererTcmalloc() { std::string result; @@ -691,8 +673,6 @@ void RenderThread::EnsureWebKitInitialized() { WebString extension_scheme(ASCIIToUTF16(chrome::kExtensionScheme)); WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme); - RegisterExtension(extensions_v8::LoadTimesExtension::Get()); - if (command_line.HasSwitch(switches::kEnableBenchmarking)) RegisterExtension(extensions_v8::BenchmarkingExtension::Get()); @@ -702,9 +682,6 @@ void RenderThread::EnsureWebKitInitialized() { RegisterExtension(extensions_v8::PlaybackExtension::Get()); } - if (command_line.HasSwitch(switches::kDomAutomationController)) - RegisterExtension(DomAutomationV8Extension::Get()); - web_database_observer_impl_.reset(new WebDatabaseObserverImpl(this)); WebKit::WebDatabase::setObserver(web_database_observer_impl_.get()); diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h index ffca2dc..3b963dc 100644 --- a/chrome/renderer/render_thread.h +++ b/chrome/renderer/render_thread.h @@ -179,12 +179,6 @@ class RenderThread : public RenderThreadBase, idle_notification_delay_in_s_ = idle_notification_delay_in_s; } - // Do DNS prefetch resolution of a hostname. - void Resolve(const char* name, size_t length); - - // Send all the Histogram data to browser. - void SendHistograms(int sequence_number); - // Sends a message to the browser to close all connections. void CloseCurrentConnections(); @@ -267,9 +261,6 @@ class RenderThread : public RenderThreadBase, void OnClearCache(); void OnGetCacheResourceStats(); - // Send all histograms to browser. - void OnGetRendererHistograms(int sequence_number); - // Send tcmalloc info to browser. void OnGetRendererTcmalloc(); void OnGetV8HeapStats(); @@ -288,10 +279,8 @@ class RenderThread : public RenderThreadBase, // These objects live solely on the render thread. scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > task_factory_; - scoped_ptr<RendererNetPredictor> renderer_net_predictor_; scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; scoped_ptr<IndexedDBDispatcher> indexed_db_dispatcher_; - scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_; scoped_ptr<RendererWebKitClientImpl> webkit_client_; scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_; diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index 84a7ff8..8481945 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -20,7 +20,6 @@ #include "chrome/common/chrome_version_info.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" -#include "chrome/renderer/net/renderer_net_predictor.h" #include "chrome/renderer/render_process.h" #include "chrome/renderer/render_thread.h" #include "content/common/clipboard_messages.h" @@ -127,16 +126,6 @@ ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() { namespace webkit_glue { -void PrecacheUrl(const wchar_t* url, int url_length) { - // TBD: jar: Need implementation that loads the targetted URL into our cache. - // For now, at least prefetch DNS lookup - std::string url_string; - WideToUTF8(url, url_length, &url_string); - const std::string host = GURL(url_string).host(); - if (!host.empty()) - DnsPrefetchCString(host.data(), host.length()); -} - void AppendToLog(const char* file, int line, const char* msg) { logging::LogMessage(file, line).stream() << msg; } diff --git a/chrome/renderer/renderer_histogram_snapshots.cc b/chrome/renderer/renderer_histogram_snapshots.cc index bc91647..f8a7794 100644 --- a/chrome/renderer/renderer_histogram_snapshots.cc +++ b/chrome/renderer/renderer_histogram_snapshots.cc @@ -33,6 +33,20 @@ void RendererHistogramSnapshots::SendHistograms(int sequence_number) { &RendererHistogramSnapshots::UploadAllHistrograms, sequence_number)); } +bool RendererHistogramSnapshots::OnControlMessageReceived( + const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(RendererHistogramSnapshots, message) + IPC_MESSAGE_HANDLER(ViewMsg_GetRendererHistograms, OnGetRendererHistograms) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} + +void RendererHistogramSnapshots::OnGetRendererHistograms(int sequence_number) { + SendHistograms(sequence_number); +} + void RendererHistogramSnapshots::UploadAllHistrograms(int sequence_number) { DCHECK_EQ(0u, pickled_histograms_.size()); diff --git a/chrome/renderer/renderer_histogram_snapshots.h b/chrome/renderer/renderer_histogram_snapshots.h index de3ccc4..c21fd4b 100644 --- a/chrome/renderer/renderer_histogram_snapshots.h +++ b/chrome/renderer/renderer_histogram_snapshots.h @@ -15,8 +15,10 @@ #include "base/process.h" #include "base/task.h" #include "chrome/common/metrics_helpers.h" +#include "content/renderer/render_process_observer.h" -class RendererHistogramSnapshots : public HistogramSender { +class RendererHistogramSnapshots : public HistogramSender, + public RenderProcessObserver { public: RendererHistogramSnapshots(); ~RendererHistogramSnapshots(); @@ -25,6 +27,11 @@ class RendererHistogramSnapshots : public HistogramSender { void SendHistograms(int sequence_number); private: + // RenderProcessObserver implementation. + virtual bool OnControlMessageReceived(const IPC::Message& message); + + void OnGetRendererHistograms(int sequence_number); + // Maintain a map of histogram names to the sample stats we've sent. typedef std::map<std::string, base::Histogram::SampleSet> LoggedSampleMap; typedef std::vector<std::string> HistogramPickledList; diff --git a/content/renderer/content_renderer_client.cc b/content/renderer/content_renderer_client.cc index 87dd711..a585849 100644 --- a/content/renderer/content_renderer_client.cc +++ b/content/renderer/content_renderer_client.cc @@ -77,4 +77,8 @@ bool ContentRendererClient::IsLinkVisited(unsigned long long link_hash) { return false; } +void ContentRendererClient::PrefetchHostName(const char* hostname, + size_t length) { +} + } // namespace content diff --git a/content/renderer/content_renderer_client.h b/content/renderer/content_renderer_client.h index 1dc9450..675fa3b 100644 --- a/content/renderer/content_renderer_client.h +++ b/content/renderer/content_renderer_client.h @@ -83,6 +83,7 @@ class ContentRendererClient { virtual unsigned long long VisitedLinkHash(const char* canonical_url, size_t length); virtual bool IsLinkVisited(unsigned long long link_hash); + virtual void PrefetchHostName(const char* hostname, size_t length); }; } // namespace content diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index 74ef462..f659173 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -38,7 +38,6 @@ #include "chrome/renderer/automation/dom_automation_controller.h" #include "chrome/renderer/external_host_bindings.h" #include "chrome/renderer/localized_error.h" -#include "chrome/renderer/page_load_histograms.h" #include "chrome/renderer/render_process.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/searchbox.h" @@ -933,7 +932,6 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) { OnJavaScriptStressTestControl) IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged) - // TODO(viettrungluu): Move to a separate message filter. #if defined(ENABLE_FLAPPER_HACKS) IPC_MESSAGE_HANDLER(PepperMsg_ConnectTcpACK, OnConnectTcpACK) @@ -2293,8 +2291,6 @@ void RenderView::frameDetached(WebFrame* frame) { } void RenderView::willClose(WebFrame* frame) { - page_load_histograms_.Dump(frame); - FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); } @@ -3156,8 +3152,11 @@ void RenderView::logCrossFramePropertyAccess(WebFrame* frame, bool cross_origin, const WebString& property_name, unsigned long long event_id) { - // TODO(johnnyg): track the individual properties and repeat event_ids. - page_load_histograms_.IncrementCrossFramePropertyAccess(cross_origin); + FOR_EACH_OBSERVER( + RenderViewObserver, + observers_, + LogCrossFramePropertyAccess( + frame, target, cross_origin, property_name, event_id)); } void RenderView::didChangeContentsSize(WebFrame* frame, const WebSize& size) { @@ -4212,11 +4211,6 @@ void RenderView::OnClosePage(const ViewMsg_ClosePage_Params& params) { // revisited to avoid having two ways to close a page. Having a single way // to close that can run onunload is also useful for fixing // http://b/issue?id=753080. - // TODO(davemoore) This code should be removed once willClose() gets - // called when a page is destroyed. page_load_histograms_.Dump() is safe - // to call multiple times for the same frame, but it will simplify things. - page_load_histograms_.Dump(webview()->mainFrame()); - page_load_histograms_.ResetCrossFramePropertyAccess(); webview()->dispatchUnloadEvent(); // Just echo back the params in the ACK. diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h index f1c983e..9e7d852 100644 --- a/content/renderer/render_view.h +++ b/content/renderer/render_view.h @@ -24,7 +24,6 @@ #include "chrome/common/content_settings.h" #include "chrome/common/search_provider.h" #include "chrome/common/view_types.h" -#include "chrome/renderer/page_load_histograms.h" #include "content/renderer/renderer_webcookiejar_impl.h" #include "content/common/edit_command.h" #include "content/common/navigation_gesture.h" @@ -1228,9 +1227,6 @@ class RenderView : public RenderWidget, // Set if we are waiting for a accessibility notification ack. bool accessibility_ack_pending_; - // Responsible for sending page load related histograms. - PageLoadHistograms page_load_histograms_; - // Dispatches all P2P socket used by the renderer. P2PSocketDispatcher* p2p_socket_dispatcher_; diff --git a/content/renderer/render_view_observer.h b/content/renderer/render_view_observer.h index 9a49bdc..6d8c81b 100644 --- a/content/renderer/render_view_observer.h +++ b/content/renderer/render_view_observer.h @@ -16,6 +16,7 @@ class WebDataSource; class WebFrame; class WebFormElement; class WebMouseEvent; +class WebString; class WebURL; struct WebURLError; } @@ -55,6 +56,12 @@ class RenderViewObserver : public IPC::Channel::Listener, virtual void DidCreateDataSource(WebKit::WebFrame* frame, WebKit::WebDataSource* ds) {} virtual void PrintPage(WebKit::WebFrame* frame) {} + virtual void LogCrossFramePropertyAccess( + WebKit::WebFrame* frame, + WebKit::WebFrame* target, + bool cross_origin, + const WebKit::WebString& property_name, + unsigned long long event_id) {} // These match the RenderView methods below. virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} diff --git a/content/renderer/renderer_webkitclient_impl.cc b/content/renderer/renderer_webkitclient_impl.cc index 6ae54fc..46f189f 100644 --- a/content/renderer/renderer_webkitclient_impl.cc +++ b/content/renderer/renderer_webkitclient_impl.cc @@ -216,11 +216,13 @@ RendererWebKitClientImpl::createMessagePortChannel() { } void RendererWebKitClientImpl::prefetchHostName(const WebString& hostname) { - if (!hostname.isEmpty()) { - std::string hostname_utf8; - UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8); - DnsPrefetchCString(hostname_utf8.data(), hostname_utf8.length()); - } + if (hostname.isEmpty()) + return; + + std::string hostname_utf8; + UTF16ToUTF8(hostname.data(), hostname.length(), &hostname_utf8); + content::GetContentClient()->renderer()->PrefetchHostName( + hostname_utf8.data(), hostname_utf8.length()); } bool RendererWebKitClientImpl::CheckPreparsedJsCachingEnabled() const { diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 5df4a52..7a8bedb 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -156,11 +156,6 @@ int GetGlyphPageCount(); //---- BEGIN FUNCTIONS IMPLEMENTED BY EMBEDDER -------------------------------- -// This function is called to request a prefetch of the entire URL, loading it -// into our cache for (expected) future needs. The given URL may NOT be in -// canonical form and it will NOT be null-terminated; use the length instead. -void PrecacheUrl(const char16* url, int url_length); - // This function is called to add a line to the application's log file. void AppendToLog(const char* filename, int line, const char* message); diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 5d9f533..c8da97b 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -625,8 +625,6 @@ WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() { namespace webkit_glue { -void PrecacheUrl(const char16* url, int url_length) {} - void AppendToLog(const char* file, int line, const char* msg) { logging::LogMessage(file, line).stream() << msg; } |