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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 190693002: Migrate Telemetry from beginWindowSnapshotPNG to Page.captureScreenshot (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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 | « content/renderer/render_view_impl.h ('k') | content/test/data/gpu/screenshot_sync.html » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 #endif 663 #endif
664 #if defined(OS_WIN) 664 #if defined(OS_WIN)
665 focused_plugin_id_(-1), 665 focused_plugin_id_(-1),
666 #endif 666 #endif
667 #if defined(ENABLE_PLUGINS) 667 #if defined(ENABLE_PLUGINS)
668 plugin_find_handler_(NULL), 668 plugin_find_handler_(NULL),
669 focused_pepper_plugin_(NULL), 669 focused_pepper_plugin_(NULL),
670 pepper_last_mouse_event_target_(NULL), 670 pepper_last_mouse_event_target_(NULL),
671 #endif 671 #endif
672 enumeration_completion_id_(0), 672 enumeration_completion_id_(0),
673 session_storage_namespace_id_(params->session_storage_namespace_id), 673 session_storage_namespace_id_(params->session_storage_namespace_id) {
674 next_snapshot_id_(0) {
675 } 674 }
676 675
677 void RenderViewImpl::Initialize(RenderViewImplParams* params) { 676 void RenderViewImpl::Initialize(RenderViewImplParams* params) {
678 routing_id_ = params->routing_id; 677 routing_id_ = params->routing_id;
679 surface_id_ = params->surface_id; 678 surface_id_ = params->surface_id;
680 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) 679 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created)
681 opener_id_ = params->opener_id; 680 opener_id_ = params->opener_id;
682 681
683 // Ensure we start with a valid next_page_id_ from the browser. 682 // Ensure we start with a valid next_page_id_ from the browser.
684 DCHECK_GE(next_page_id_, 0); 683 DCHECK_GE(next_page_id_, 0);
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) 1116 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks)
1118 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) 1117 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu)
1119 // TODO(viettrungluu): Move to a separate message filter. 1118 // TODO(viettrungluu): Move to a separate message filter.
1120 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, 1119 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune,
1121 OnSetHistoryLengthAndPrune) 1120 OnSetHistoryLengthAndPrune)
1122 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1121 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1123 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) 1122 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode)
1124 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) 1123 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener)
1125 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, 1124 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap,
1126 OnReleaseDisambiguationPopupBitmap) 1125 OnReleaseDisambiguationPopupBitmap)
1127 IPC_MESSAGE_HANDLER(ViewMsg_WindowSnapshotCompleted, 1126 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw)
1128 OnWindowSnapshotCompleted)
1129 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) 1127 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret)
1130 #if defined(OS_ANDROID) 1128 #if defined(OS_ANDROID)
1131 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult, 1129 IPC_MESSAGE_HANDLER(InputMsg_ActivateNearestFindResult,
1132 OnActivateNearestFindResult) 1130 OnActivateNearestFindResult)
1133 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) 1131 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects)
1134 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) 1132 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems)
1135 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, 1133 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState,
1136 OnUpdateTopControlsState) 1134 OnUpdateTopControlsState)
1137 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) 1135 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData)
1138 #elif defined(OS_MACOSX) 1136 #elif defined(OS_MACOSX)
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog 1333 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog
1336 // it is particularly important that we do not call willEnterModalLoop as 1334 // it is particularly important that we do not call willEnterModalLoop as
1337 // that would defer resource loads for the dialog itself. 1335 // that would defer resource loads for the dialog itself.
1338 if (RenderThreadImpl::current()) // Will be NULL during unit tests. 1336 if (RenderThreadImpl::current()) // Will be NULL during unit tests.
1339 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); 1337 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop();
1340 1338
1341 message->EnableMessagePumping(); // Runs a nested message loop. 1339 message->EnableMessagePumping(); // Runs a nested message loop.
1342 return Send(message); 1340 return Send(message);
1343 } 1341 }
1344 1342
1345 void RenderViewImpl::GetWindowSnapshot(const WindowSnapshotCallback& callback) { 1343 void RenderViewImpl::OnForceRedraw(int id) {
1346 int id = next_snapshot_id_++;
1347 pending_snapshots_.insert(std::make_pair(id, callback));
1348 ui::LatencyInfo latency_info; 1344 ui::LatencyInfo latency_info;
1349 latency_info.AddLatencyNumber(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, 1345 latency_info.AddLatencyNumber(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT,
1350 0, 1346 0,
1351 id); 1347 id);
1352 scoped_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor; 1348 scoped_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor;
1353 if (RenderWidgetCompositor* rwc = compositor()) { 1349 if (RenderWidgetCompositor* rwc = compositor()) {
1354 latency_info_swap_promise_monitor = 1350 latency_info_swap_promise_monitor =
1355 rwc->CreateLatencyInfoSwapPromiseMonitor(&latency_info).Pass(); 1351 rwc->CreateLatencyInfoSwapPromiseMonitor(&latency_info).Pass();
1356 } 1352 }
1357 ScheduleCompositeWithForcedRedraw(); 1353 ScheduleCompositeWithForcedRedraw();
1358 } 1354 }
1359 1355
1360 void RenderViewImpl::OnWindowSnapshotCompleted(const int snapshot_id,
1361 const gfx::Size& size, const std::vector<unsigned char>& png) {
1362
1363 // Any pending snapshots with a lower ID than the one received are considered
1364 // to be implicitly complete, and returned the same snapshot data.
1365 PendingSnapshotMap::iterator it = pending_snapshots_.begin();
1366 while(it != pending_snapshots_.end()) {
1367 if (it->first <= snapshot_id) {
1368 it->second.Run(size, png);
1369 pending_snapshots_.erase(it++);
1370 } else {
1371 ++it;
1372 }
1373 }
1374 }
1375
1376 // blink::WebViewClient ------------------------------------------------------ 1356 // blink::WebViewClient ------------------------------------------------------
1377 1357
1378 WebView* RenderViewImpl::createView(WebLocalFrame* creator, 1358 WebView* RenderViewImpl::createView(WebLocalFrame* creator,
1379 const WebURLRequest& request, 1359 const WebURLRequest& request,
1380 const WebWindowFeatures& features, 1360 const WebWindowFeatures& features,
1381 const WebString& frame_name, 1361 const WebString& frame_name,
1382 WebNavigationPolicy policy, 1362 WebNavigationPolicy policy,
1383 bool suppress_opener) { 1363 bool suppress_opener) {
1384 ViewHostMsg_CreateWindow_Params params; 1364 ViewHostMsg_CreateWindow_Params params;
1385 params.opener_id = routing_id_; 1365 params.opener_id = routing_id_;
(...skipping 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after
4058 std::vector<gfx::Size> sizes; 4038 std::vector<gfx::Size> sizes;
4059 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4039 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4060 if (!url.isEmpty()) 4040 if (!url.isEmpty())
4061 urls.push_back( 4041 urls.push_back(
4062 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4042 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4063 } 4043 }
4064 SendUpdateFaviconURL(urls); 4044 SendUpdateFaviconURL(urls);
4065 } 4045 }
4066 4046
4067 } // namespace content 4047 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/test/data/gpu/screenshot_sync.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698