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

Side by Side Diff: content/renderer/gpu/gpu_benchmarking_extension.cc

Issue 1463823002: Add DriverBugWorkaroundsInGpuProcessPage to gpu_process_test.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a testing GpuChannelMsg_GetDriverBugWorkArounds IPC message and use it in a new browser test Created 4 years, 8 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
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/gpu/gpu_benchmarking_extension.h" 5 #include "content/renderer/gpu/gpu_benchmarking_extension.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 14 matching lines...) Expand all
25 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
26 #include "content/public/renderer/chrome_object_extensions_utils.h" 26 #include "content/public/renderer/chrome_object_extensions_utils.h"
27 #include "content/public/renderer/render_thread.h" 27 #include "content/public/renderer/render_thread.h"
28 #include "content/renderer/gpu/render_widget_compositor.h" 28 #include "content/renderer/gpu/render_widget_compositor.h"
29 #include "content/renderer/render_thread_impl.h" 29 #include "content/renderer/render_thread_impl.h"
30 #include "content/renderer/render_view_impl.h" 30 #include "content/renderer/render_view_impl.h"
31 #include "content/renderer/skia_benchmarking_extension.h" 31 #include "content/renderer/skia_benchmarking_extension.h"
32 #include "gin/arguments.h" 32 #include "gin/arguments.h"
33 #include "gin/handle.h" 33 #include "gin/handle.h"
34 #include "gin/object_template_builder.h" 34 #include "gin/object_template_builder.h"
35 #include "gpu/ipc/common/gpu_messages.h"
35 #include "third_party/WebKit/public/web/WebImageCache.h" 36 #include "third_party/WebKit/public/web/WebImageCache.h"
36 #include "third_party/WebKit/public/web/WebKit.h" 37 #include "third_party/WebKit/public/web/WebKit.h"
37 #include "third_party/WebKit/public/web/WebLocalFrame.h" 38 #include "third_party/WebKit/public/web/WebLocalFrame.h"
38 #include "third_party/WebKit/public/web/WebView.h" 39 #include "third_party/WebKit/public/web/WebView.h"
39 #include "third_party/skia/include/core/SkData.h" 40 #include "third_party/skia/include/core/SkData.h"
40 #include "third_party/skia/include/core/SkGraphics.h" 41 #include "third_party/skia/include/core/SkGraphics.h"
41 #include "third_party/skia/include/core/SkPicture.h" 42 #include "third_party/skia/include/core/SkPicture.h"
42 #include "third_party/skia/include/core/SkPixelRef.h" 43 #include "third_party/skia/include/core/SkPixelRef.h"
43 #include "third_party/skia/include/core/SkPixelSerializer.h" 44 #include "third_party/skia/include/core/SkPixelSerializer.h"
44 #include "third_party/skia/include/core/SkStream.h" 45 #include "third_party/skia/include/core/SkStream.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 .SetMethod("scrollBounce", &GpuBenchmarking::ScrollBounce) 497 .SetMethod("scrollBounce", &GpuBenchmarking::ScrollBounce)
497 .SetMethod("pinchBy", &GpuBenchmarking::PinchBy) 498 .SetMethod("pinchBy", &GpuBenchmarking::PinchBy)
498 .SetMethod("visualViewportHeight", &GpuBenchmarking::VisualViewportHeight) 499 .SetMethod("visualViewportHeight", &GpuBenchmarking::VisualViewportHeight)
499 .SetMethod("visualViewportWidth", &GpuBenchmarking::VisualViewportWidth) 500 .SetMethod("visualViewportWidth", &GpuBenchmarking::VisualViewportWidth)
500 .SetMethod("tap", &GpuBenchmarking::Tap) 501 .SetMethod("tap", &GpuBenchmarking::Tap)
501 .SetMethod("clearImageCache", &GpuBenchmarking::ClearImageCache) 502 .SetMethod("clearImageCache", &GpuBenchmarking::ClearImageCache)
502 .SetMethod("runMicroBenchmark", &GpuBenchmarking::RunMicroBenchmark) 503 .SetMethod("runMicroBenchmark", &GpuBenchmarking::RunMicroBenchmark)
503 .SetMethod("sendMessageToMicroBenchmark", 504 .SetMethod("sendMessageToMicroBenchmark",
504 &GpuBenchmarking::SendMessageToMicroBenchmark) 505 &GpuBenchmarking::SendMessageToMicroBenchmark)
505 .SetMethod("hasGpuChannel", &GpuBenchmarking::HasGpuChannel) 506 .SetMethod("hasGpuChannel", &GpuBenchmarking::HasGpuChannel)
506 .SetMethod("hasGpuProcess", &GpuBenchmarking::HasGpuProcess); 507 .SetMethod("hasGpuProcess", &GpuBenchmarking::HasGpuProcess)
508 .SetMethod("getGpuDriverBugWorkarounds",
509 &GpuBenchmarking::GetGpuDriverBugWorkarounds);
507 } 510 }
508 511
509 void GpuBenchmarking::SetNeedsDisplayOnAllLayers() { 512 void GpuBenchmarking::SetNeedsDisplayOnAllLayers() {
510 GpuBenchmarkingContext context; 513 GpuBenchmarkingContext context;
511 if (!context.Init(true)) 514 if (!context.Init(true))
512 return; 515 return;
513 516
514 context.compositor()->SetNeedsDisplayOnAllLayers(); 517 context.compositor()->SetNeedsDisplayOnAllLayers();
515 } 518 }
516 519
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 918
916 bool GpuBenchmarking::HasGpuProcess() { 919 bool GpuBenchmarking::HasGpuProcess() {
917 bool has_gpu_process = false; 920 bool has_gpu_process = false;
918 if (!RenderThreadImpl::current()->Send( 921 if (!RenderThreadImpl::current()->Send(
919 new ChildProcessHostMsg_HasGpuProcess(&has_gpu_process))) 922 new ChildProcessHostMsg_HasGpuProcess(&has_gpu_process)))
920 return false; 923 return false;
921 924
922 return has_gpu_process; 925 return has_gpu_process;
923 } 926 }
924 927
928 void GpuBenchmarking::GetGpuDriverBugWorkarounds(gin::Arguments* args) {
929 std::vector<std::string> gpu_driver_bug_workarounds;
930 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel();
931 if (!gpu_channel->Send(new GpuChannelMsg_GetDriverBugWorkArounds(
932 &gpu_driver_bug_workarounds))) {
933 return;
934 }
935
936 v8::Isolate* isolate = args->isolate();
dcheng 2016/03/30 23:45:25 Does Converter::ToV8() work? https://code.google.c
Julien Isorce Samsung 2016/03/31 15:20:09 gin::TryConvertToV8 works so I'll use it, thx.
937 v8::Local<v8::Array> result =
938 v8::Array::New(isolate, gpu_driver_bug_workarounds.size());
939 for (size_t i = 0; i < gpu_driver_bug_workarounds.size(); ++i)
940 result->Set(i, v8::String::NewFromUtf8(
941 isolate, gpu_driver_bug_workarounds[i].c_str()));
942
943 args->Return(v8::Local<v8::Object>::Cast(result));
944 }
945
925 } // namespace content 946 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698