#ifndef CONTENT_RENDERER_GPU_BENCHMARKING_EXTENSION_H_
#define CONTENT_RENDERER_GPU_BENCHMARKING_EXTENSION_H_
#include "base/memory/weak_ptr.h"
#include "content/common/input/input_injector.mojom.h"
#include "gin/wrappable.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace gin {
class Arguments;
}
namespace v8 {
class Isolate;
class Object;
}
namespace content {
class RenderFrameImpl;
class GpuBenchmarking : public gin::Wrappable<GpuBenchmarking> {
public:
static constexpr gin::WrapperInfo kWrapperInfo = {{gin::kEmbedderNativeGin},
gin::kGpuBenchmarking};
GpuBenchmarking(const GpuBenchmarking&) = delete;
GpuBenchmarking& operator=(const GpuBenchmarking&) = delete;
static void Install(base::WeakPtr<RenderFrameImpl> frame);
explicit GpuBenchmarking(base::WeakPtr<RenderFrameImpl> frame);
~GpuBenchmarking() override;
private:
void EnsureRemoteInterface();
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
void SetNeedsDisplayOnAllLayers();
void SetRasterizeOnlyVisibleContent();
void PrintToSkPicture(v8::Isolate* isolate, const std::string& dirname);
void PrintPagesToSkPictures(v8::Isolate* isolate,
const std::string& filename);
void PrintPagesToXPS(v8::Isolate* isolate, const std::string& filename);
bool GestureSourceTypeSupported(int gesture_source_type);
bool SmoothScrollBy(gin::Arguments* args);
bool SmoothScrollByXY(gin::Arguments* args);
bool SmoothDrag(gin::Arguments* args);
bool Swipe(gin::Arguments* args);
bool ScrollBounce(gin::Arguments* args);
bool PinchBy(gin::Arguments* args);
bool Tap(gin::Arguments* args);
bool PointerActionSequence(gin::Arguments* args);
float VisualViewportX();
float VisualViewportY();
float VisualViewportHeight();
float VisualViewportWidth();
float PageScaleFactor();
void SetPageScaleFactor(float scale);
void SetBrowserControlsShown(bool shown);
void ClearImageCache();
int RunMicroBenchmark(gin::Arguments* args);
bool SendMessageToMicroBenchmark(int id, v8::Local<v8::Object> message);
bool HasGpuChannel();
bool HasGpuProcess();
void CrashGpuProcess();
void TerminateGpuProcessNormally();
void GetGpuDriverBugWorkarounds(gin::Arguments* args);
void StartProfiling(gin::Arguments* args);
void StopProfiling();
void Freeze();
bool AddSwapCompletionEventListener(gin::Arguments* args);
int AddCoreAnimationStatusEventListener(gin::Arguments* args);
bool IsAcceleratedCanvasImageSource(gin::Arguments* args);
const gin::WrapperInfo* wrapper_info() const override;
base::WeakPtr<RenderFrameImpl> render_frame_;
mojo::Remote<mojom::InputInjector> input_injector_;
};
}
#endif