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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 115468: Only send SelectionChanged events when the selection has actually changed.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 } 2480 }
2481 } 2481 }
2482 2482
2483 void RenderView::SetTooltipText(WebView* webview, 2483 void RenderView::SetTooltipText(WebView* webview,
2484 const std::wstring& tooltip_text) { 2484 const std::wstring& tooltip_text) {
2485 Send(new ViewHostMsg_SetTooltipText(routing_id_, tooltip_text)); 2485 Send(new ViewHostMsg_SetTooltipText(routing_id_, tooltip_text));
2486 } 2486 }
2487 2487
2488 void RenderView::DidChangeSelection(bool is_empty_selection) { 2488 void RenderView::DidChangeSelection(bool is_empty_selection) {
2489 #if defined(OS_LINUX) 2489 #if defined(OS_LINUX)
2490 // TODO(estade): investigate incremental updates to the selection so that we
2491 // don't send the entire selection over IPC every time.
2490 if (!is_empty_selection) { 2492 if (!is_empty_selection) {
2493 // Sometimes we get repeated DidChangeSelection calls from webkit when
2494 // the selection hasn't actually changed. We don't want to report these
2495 // because it will cause us to continually claim the X clipboard.
2496 std::string this_selection =
darin (slow to review) 2009/05/18 17:09:28 minor nit: "const std::string& this_selection ="
Evan Stade 2009/05/18 17:14:23 I had that at first, but GetSelection() returns a
2497 webview()->GetFocusedFrame()->GetSelection(false);
2498 if (this_selection == last_selection_)
2499 return;
2500
2491 Send(new ViewHostMsg_SelectionChanged(routing_id_, 2501 Send(new ViewHostMsg_SelectionChanged(routing_id_,
2492 webview()->GetFocusedFrame()->GetSelection(false))); 2502 this_selection));
2503 last_selection_ = this_selection;
2493 } 2504 }
2494 #endif 2505 #endif
2495 } 2506 }
2496 2507
2497 void RenderView::DownloadUrl(const GURL& url, const GURL& referrer) { 2508 void RenderView::DownloadUrl(const GURL& url, const GURL& referrer) {
2498 Send(new ViewHostMsg_DownloadUrl(routing_id_, url, referrer)); 2509 Send(new ViewHostMsg_DownloadUrl(routing_id_, url, referrer));
2499 } 2510 }
2500 2511
2501 WebDevToolsAgentDelegate* RenderView::GetWebDevToolsAgentDelegate() { 2512 WebDevToolsAgentDelegate* RenderView::GetWebDevToolsAgentDelegate() {
2502 return devtools_agent_.get(); 2513 return devtools_agent_.get();
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
3006 } 3017 }
3007 } 3018 }
3008 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinishDoc", start_to_finish_doc); 3019 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinishDoc", start_to_finish_doc);
3009 UMA_HISTOGRAM_TIMES("Renderer.All.FinishDocToFinish", finish_doc_to_finish); 3020 UMA_HISTOGRAM_TIMES("Renderer.All.FinishDocToFinish", finish_doc_to_finish);
3010 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinish", start_to_finish); 3021 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinish", start_to_finish);
3011 if (start_to_first_layout.ToInternalValue() >= 0) { 3022 if (start_to_first_layout.ToInternalValue() >= 0) {
3012 UMA_HISTOGRAM_TIMES( 3023 UMA_HISTOGRAM_TIMES(
3013 "Renderer.All.StartToFirstLayout", start_to_first_layout); 3024 "Renderer.All.StartToFirstLayout", start_to_first_layout);
3014 } 3025 }
3015 } 3026 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698