OLD | NEW |
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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 // stable. | 460 // stable. |
461 .SetValue("newPinchInterface", true) | 461 .SetValue("newPinchInterface", true) |
462 .SetMethod("pinchBy", &GpuBenchmarking::PinchBy) | 462 .SetMethod("pinchBy", &GpuBenchmarking::PinchBy) |
463 .SetMethod("visualViewportHeight", &GpuBenchmarking::VisualViewportHeight) | 463 .SetMethod("visualViewportHeight", &GpuBenchmarking::VisualViewportHeight) |
464 .SetMethod("visualViewportWidth", &GpuBenchmarking::VisualViewportWidth) | 464 .SetMethod("visualViewportWidth", &GpuBenchmarking::VisualViewportWidth) |
465 .SetMethod("tap", &GpuBenchmarking::Tap) | 465 .SetMethod("tap", &GpuBenchmarking::Tap) |
466 .SetMethod("clearImageCache", &GpuBenchmarking::ClearImageCache) | 466 .SetMethod("clearImageCache", &GpuBenchmarking::ClearImageCache) |
467 .SetMethod("runMicroBenchmark", &GpuBenchmarking::RunMicroBenchmark) | 467 .SetMethod("runMicroBenchmark", &GpuBenchmarking::RunMicroBenchmark) |
468 .SetMethod("sendMessageToMicroBenchmark", | 468 .SetMethod("sendMessageToMicroBenchmark", |
469 &GpuBenchmarking::SendMessageToMicroBenchmark) | 469 &GpuBenchmarking::SendMessageToMicroBenchmark) |
| 470 .SetMethod("hasGpuChannel", &GpuBenchmarking::HasGpuChannel) |
470 .SetMethod("hasGpuProcess", &GpuBenchmarking::HasGpuProcess); | 471 .SetMethod("hasGpuProcess", &GpuBenchmarking::HasGpuProcess); |
471 } | 472 } |
472 | 473 |
473 void GpuBenchmarking::SetNeedsDisplayOnAllLayers() { | 474 void GpuBenchmarking::SetNeedsDisplayOnAllLayers() { |
474 GpuBenchmarkingContext context; | 475 GpuBenchmarkingContext context; |
475 if (!context.Init(true)) | 476 if (!context.Init(true)) |
476 return; | 477 return; |
477 | 478 |
478 context.compositor()->SetNeedsDisplayOnAllLayers(); | 479 context.compositor()->SetNeedsDisplayOnAllLayers(); |
479 } | 480 } |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 make_scoped_ptr(V8ValueConverter::create()); | 862 make_scoped_ptr(V8ValueConverter::create()); |
862 v8::Local<v8::Context> v8_context = | 863 v8::Local<v8::Context> v8_context = |
863 context.web_frame()->mainWorldScriptContext(); | 864 context.web_frame()->mainWorldScriptContext(); |
864 scoped_ptr<base::Value> value = | 865 scoped_ptr<base::Value> value = |
865 make_scoped_ptr(converter->FromV8Value(message, v8_context)); | 866 make_scoped_ptr(converter->FromV8Value(message, v8_context)); |
866 | 867 |
867 return context.compositor()->SendMessageToMicroBenchmark(id, | 868 return context.compositor()->SendMessageToMicroBenchmark(id, |
868 std::move(value)); | 869 std::move(value)); |
869 } | 870 } |
870 | 871 |
| 872 bool GpuBenchmarking::HasGpuChannel() { |
| 873 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
| 874 return !!gpu_channel; |
| 875 } |
| 876 |
871 bool GpuBenchmarking::HasGpuProcess() { | 877 bool GpuBenchmarking::HasGpuProcess() { |
872 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 878 return RenderThreadImpl::current()->HasGpuProcess(); |
873 return !!gpu_channel; | |
874 } | 879 } |
875 | 880 |
876 } // namespace content | 881 } // namespace content |
OLD | NEW |