diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 00:32:45 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 00:32:45 +0000 |
commit | a8a812927466ad39a65b718049ffcd76c24e6a1e (patch) | |
tree | 349d438d0436fad66fcf2c83ccb6c52722794b06 /chrome/renderer/render_view.cc | |
parent | c55fd9484f10cb72736e0a6688f7ed0db5435af8 (diff) | |
download | chromium_src-a8a812927466ad39a65b718049ffcd76c24e6a1e.zip chromium_src-a8a812927466ad39a65b718049ffcd76c24e6a1e.tar.gz chromium_src-a8a812927466ad39a65b718049ffcd76c24e6a1e.tar.bz2 |
One more attempt at landing this CL.
There are now memory errors in the CLD library that cause memory crashers in reliability tests.
I will add reliability failures to the know_crashes.txt file while the memory errors are being fixed.
Original review:
http://codereview.chromium.org/492024/show
BUG=30662
TEST=Run the unit-tests.
TBR=brettw
Review URL: http://codereview.chromium.org/555014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36707 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.cc')
-rw-r--r-- | chrome/renderer/render_view.cc | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index ed8b7a3..ae63e2b 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -301,7 +301,6 @@ RenderView::RenderView(RenderThreadBase* render_thread, send_preferred_size_changes_(false), ALLOW_THIS_IN_INITIALIZER_LIST( notification_provider_(new NotificationProvider(this))), - determine_page_text_after_loading_stops_(false), view_type_(ViewType::INVALID), browser_window_id_(-1), last_top_level_navigation_page_id_(-1), @@ -492,7 +491,6 @@ void RenderView::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) IPC_MESSAGE_HANDLER(ViewMsg_ExecuteEditCommand, OnExecuteEditCommand) IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind) - IPC_MESSAGE_HANDLER(ViewMsg_DeterminePageLanguage, OnDeterminePageLanguage) IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingHost, OnSetZoomLevelForLoadingHost) @@ -663,24 +661,24 @@ void RenderView::CapturePageInfo(int load_id, bool preliminary_capture) { if (!preliminary_capture) last_indexed_page_id_ = load_id; - // get the URL for this page + // Get the URL for this page. GURL url(main_frame->url()); if (url.is_empty()) return; - // full text + // Retrieve the frame's full text. std::wstring contents; CaptureText(main_frame, &contents); if (contents.size()) { - // Send the text to the browser for indexing. - Send(new ViewHostMsg_PageContents(routing_id_, url, load_id, contents)); - } + base::TimeTicks begin_time = base::TimeTicks::Now(); + std::string language = DetermineTextLanguage(contents); + UMA_HISTOGRAM_MEDIUM_TIMES("Renderer4.LanguageDetection", + base::TimeTicks::Now() - begin_time); - // Now that we have the contents, we can determine the language if necessary. - if (determine_page_text_after_loading_stops_) { - determine_page_text_after_loading_stops_ = false; - Send(new ViewHostMsg_PageLanguageDetermined( - routing_id_, DetermineTextLanguage(contents))); + // Send the text to the browser for indexing (the browser might decide not + // to index, if the URL is HTTPS for instance) and language discovery. + Send(new ViewHostMsg_PageContents(routing_id_, url, load_id, contents, + language)); } // thumbnail @@ -692,15 +690,6 @@ void RenderView::CaptureText(WebFrame* frame, std::wstring* contents) { if (!frame) return; - // Don't index any https pages. People generally don't want their bank - // accounts, etc. indexed on their computer, especially since some of these - // things are not marked cachable. - // TODO(brettw) we may want to consider more elaborate heuristics such as - // the cachability of the page. We may also want to consider subframes (this - // test will still index subframes if the subframe is SSL). - if (GURL(frame->url()).SchemeIsSecure()) - return; - #ifdef TIME_TEXT_RETRIEVAL double begin = time_util::GetHighResolutionTimeNow(); #endif @@ -3066,17 +3055,6 @@ void RenderView::OnFind(int request_id, const string16& search_text, } } -void RenderView::OnDeterminePageLanguage() { - if (is_loading_) { - // Wait for the page to finish loading before trying to determine the - // language. - determine_page_text_after_loading_stops_ = true; - return; - } - - Send(new ViewHostMsg_PageLanguageDetermined(routing_id_, DetectLanguage())); -} - std::string RenderView::DetectLanguage() { if (!webview() || is_loading_) return kUnknownLanguageCode; |