Frame subscriber bugfix + added only_damaged option

This commit is contained in:
Heilig Benedek 2016-06-21 02:15:39 +02:00
parent a35915ee9f
commit 3529f8a40a
4 changed files with 38 additions and 16 deletions

View file

@ -20,11 +20,13 @@ namespace api {
class FrameSubscriber : public content::RenderWidgetHostViewFrameSubscriber {
public:
using FrameCaptureCallback = base::Callback<void(v8::Local<v8::Value>)>;
using FrameCaptureCallback =
base::Callback<void(v8::Local<v8::Value>, v8::Local<v8::Value>)>;
FrameSubscriber(v8::Isolate* isolate,
content::RenderWidgetHostView* view,
const FrameCaptureCallback& callback);
const FrameCaptureCallback& callback,
const bool& only_damaged);
bool ShouldCaptureFrame(const gfx::Rect& damage_rect,
base::TimeTicks present_time,
@ -33,11 +35,13 @@ class FrameSubscriber : public content::RenderWidgetHostViewFrameSubscriber {
private:
void OnFrameDelivered(const FrameCaptureCallback& callback,
const SkBitmap& bitmap, content::ReadbackResponse response);
const gfx::Rect& damage_rect, const SkBitmap& bitmap,
content::ReadbackResponse response);
v8::Isolate* isolate_;
content::RenderWidgetHostView* view_;
FrameCaptureCallback callback_;
bool only_damaged_;
base::WeakPtrFactory<FrameSubscriber> weak_factory_;