Merge pull request #6164 from MaxWhere/master

beginFrameSubscription bugfix and improvement
This commit is contained in:
Cheng Zhao 2016-06-26 02:39:59 +00:00 committed by GitHub
commit 3d2ad0080d
7 changed files with 94 additions and 31 deletions

View file

@ -1182,11 +1182,20 @@ void WebContents::SendInputEvent(v8::Isolate* isolate,
}
void WebContents::BeginFrameSubscription(
const FrameSubscriber::FrameCaptureCallback& callback) {
mate::Arguments* args) {
FrameSubscriber::FrameCaptureCallback callback;
bool only_dirty = false;
if (!args->GetNext(&callback)) {
args->GetNext(&only_dirty);
if (!args->GetNext(&callback))
args->ThrowTypeError("'callback' must be defined");
}
const auto view = web_contents()->GetRenderWidgetHostView();
if (view) {
std::unique_ptr<FrameSubscriber> frame_subscriber(new FrameSubscriber(
isolate(), view, callback));
isolate(), view, callback, only_dirty));
view->BeginFrameSubscription(std::move(frame_subscriber));
}
}