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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 121653002: Track AsyncReadback time using histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased TOT. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 0467a078140c6e83a2e8f8b36ccf4b612f67a431..3ad1368f130f848b13e8d6fcfcbba555eab6ee11 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -12,6 +12,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/histogram.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/worker_pool.h"
#include "cc/base/latency_info_swap_promise.h"
@@ -64,6 +65,7 @@ namespace content {
namespace {
const int kUndefinedOutputSurfaceId = -1;
+static const char kAsyncReadBackString[] = "Compositing.CopyFromSurfaceTime";
void InsertSyncPointAndAckForCompositor(
int renderer_host_id,
@@ -92,10 +94,13 @@ void CopyFromCompositingSurfaceFinished(
const base::Callback<void(bool, const SkBitmap&)>& callback,
scoped_ptr<cc::SingleReleaseCallback> release_callback,
scoped_ptr<SkBitmap> bitmap,
+ const base::TimeTicks& start_time,
scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock,
bool result) {
bitmap_pixels_lock.reset();
release_callback->Run(0, false);
+ UMA_HISTOGRAM_TIMES(kAsyncReadBackString,
+ base::TimeTicks::Now() - start_time);
callback.Run(result, *bitmap);
}
@@ -629,6 +634,7 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface(
const gfx::Size& dst_size,
const base::Callback<void(bool, const SkBitmap&)>& callback,
bool readback_config_rgb565) {
+ base::TimeTicks start_time = base::TimeTicks::Now();
if (!using_synchronous_compositor_ && !IsSurfaceAvailableForCopy()) {
callback.Run(false, SkBitmap());
return;
@@ -657,6 +663,8 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface(
if (using_synchronous_compositor_) {
SynchronousCopyContents(src_subrect_in_pixel, dst_size_in_pixel, callback);
+ UMA_HISTOGRAM_TIMES("Compositing.CopyFromSurfaceTimeSynchronous",
+ base::TimeTicks::Now() - start_time);
return;
}
scoped_ptr<cc::CopyOutputRequest> request;
@@ -664,12 +672,14 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface(
request = cc::CopyOutputRequest::CreateBitmapRequest(base::Bind(
&RenderWidgetHostViewAndroid::PrepareBitmapCopyOutputResult,
dst_size_in_pixel,
+ start_time,
callback));
} else {
request = cc::CopyOutputRequest::CreateRequest(base::Bind(
&RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult,
dst_size_in_pixel,
readback_config_rgb565,
+ start_time,
callback));
}
request->set_area(src_subrect_in_pixel);
@@ -1383,6 +1393,7 @@ void RenderWidgetHostViewAndroid::OnLostResources() {
void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult(
const gfx::Size& dst_size_in_pixel,
bool readback_config_rgb565,
+ const base::TimeTicks& start_time,
const base::Callback<void(bool, const SkBitmap&)>& callback,
scoped_ptr<cc::CopyOutputResult> result) {
DCHECK(result->HasTexture());
@@ -1434,12 +1445,14 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult(
callback,
base::Passed(&release_callback),
base::Passed(&bitmap),
+ start_time,
base::Passed(&bitmap_pixels_lock)));
}
// static
void RenderWidgetHostViewAndroid::PrepareBitmapCopyOutputResult(
const gfx::Size& dst_size_in_pixel,
+ const base::TimeTicks& start_time,
const base::Callback<void(bool, const SkBitmap&)>& callback,
scoped_ptr<cc::CopyOutputResult> result) {
DCHECK(result->HasBitmap());
@@ -1458,6 +1471,9 @@ void RenderWidgetHostViewAndroid::PrepareBitmapCopyOutputResult(
DCHECK_EQ(source->height(), dst_size_in_pixel.height());
ignore_result(scoped_callback_runner.Release());
+ UMA_HISTOGRAM_TIMES(kAsyncReadBackString,
+ base::TimeTicks::Now() - start_time);
+
callback.Run(true, *source);
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698