Merge remote-tracking branch 'upstream/master' into speedup-gpu
authorgellert <gellihegyi@gmail.com>
Tue, 2 Aug 2016 12:59:03 +0000 (14:59 +0200)
committergellert <gellihegyi@gmail.com>
Tue, 2 Aug 2016 12:59:03 +0000 (14:59 +0200)
1  2 
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/atom_api_web_contents.h
atom/browser/api/atom_api_window.cc
docs/api/web-contents.md

@@@ -1398,68 -1358,11 +1394,69 @@@ v8::Local<v8::Value> WebContents::Debug
    return v8::Local<v8::Value>::New(isolate, debugger_);
  }
  
 +void WebContents::OnPaint(
 +    v8::Isolate* isolate,
 +    const gfx::Rect& damage_rect,
 +    int bitmap_width,
 +    int bitmap_height,
 +    void* bitmap_pixels) {
 +  v8::MaybeLocal<v8::Object> buffer = node::Buffer::New(isolate,
 +    reinterpret_cast<char *>(bitmap_pixels), sizeof(bitmap_pixels));
 +
 +  const gfx::Size bitmap_size = gfx::Size(bitmap_width, bitmap_height);
 +  Emit("paint", damage_rect, buffer.ToLocalChecked(), bitmap_size);
 +}
 +
 +void WebContents::StartPainting() {
 +  if (IsOffScreen()) {
 +    const auto osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
 +      web_contents()->GetRenderWidgetHostView());
 +    osr_rwhv->SetPainting(true);
 +    osr_rwhv->Show();
 +  }
 +}
 +
 +void WebContents::StopPainting() {
 +  if (IsOffScreen()) {
 +    const auto osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
 +      web_contents()->GetRenderWidgetHostView());
 +    osr_rwhv->SetPainting(false);
 +    osr_rwhv->Hide();
 +  }
 +}
 +
 +bool WebContents::IsPainting() const {
 +  if (IsOffScreen()) {
 +    const auto osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
 +      web_contents()->GetRenderWidgetHostView());
 +    return osr_rwhv->IsPainting();
 +  }
 +
 +  return false;
 +}
 +
 +void WebContents::SetFrameRate(int frame_rate) {
 +  if (IsOffScreen()) {
 +    const auto osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
 +      web_contents()->GetRenderWidgetHostView());
 +    osr_rwhv->SetFrameRate(frame_rate);
 +  }
 +}
 +
 +int WebContents::GetFrameRate() const {
 +  if (IsOffScreen()) {
 +    const auto osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(
 +      web_contents()->GetRenderWidgetHostView());
 +    return osr_rwhv->GetFrameRate();
 +  }
 +  return 0;
 +}
 +
  // static
  void WebContents::BuildPrototype(v8::Isolate* isolate,
-                                  v8::Local<v8::ObjectTemplate> prototype) {
-   mate::ObjectTemplateBuilder(isolate, prototype)
+                                  v8::Local<v8::FunctionTemplate> prototype) {
+   prototype->SetClassName(mate::StringToV8(isolate, "WebContents"));
+   mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
        .MakeDestroyable()
        .SetMethod("getId", &WebContents::GetID)
        .SetMethod("equal", &WebContents::Equal)
Simple merge
Simple merge