From: gellert Date: Tue, 2 Aug 2016 12:59:03 +0000 (+0200) Subject: Merge remote-tracking branch 'upstream/master' into speedup-gpu X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8eed91d87a525901765ef33a1ce2daec33322c4e;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Merge remote-tracking branch 'upstream/master' into speedup-gpu --- 8eed91d87a525901765ef33a1ce2daec33322c4e diff --cc atom/browser/api/atom_api_web_contents.cc index d590beb,63638a2..7985103 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@@ -1398,68 -1358,11 +1394,69 @@@ v8::Local WebContents::Debug return v8::Local::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 buffer = node::Buffer::New(isolate, + reinterpret_cast(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( + web_contents()->GetRenderWidgetHostView()); + osr_rwhv->SetPainting(true); + osr_rwhv->Show(); + } +} + +void WebContents::StopPainting() { + if (IsOffScreen()) { + const auto osr_rwhv = static_cast( + web_contents()->GetRenderWidgetHostView()); + osr_rwhv->SetPainting(false); + osr_rwhv->Hide(); + } +} + +bool WebContents::IsPainting() const { + if (IsOffScreen()) { + const auto osr_rwhv = static_cast( + web_contents()->GetRenderWidgetHostView()); + return osr_rwhv->IsPainting(); + } + + return false; +} + +void WebContents::SetFrameRate(int frame_rate) { + if (IsOffScreen()) { + const auto osr_rwhv = static_cast( + web_contents()->GetRenderWidgetHostView()); + osr_rwhv->SetFrameRate(frame_rate); + } +} + +int WebContents::GetFrameRate() const { + if (IsOffScreen()) { + const auto osr_rwhv = static_cast( + web_contents()->GetRenderWidgetHostView()); + return osr_rwhv->GetFrameRate(); + } + return 0; +} + // static void WebContents::BuildPrototype(v8::Isolate* isolate, - v8::Local prototype) { - mate::ObjectTemplateBuilder(isolate, prototype) + v8::Local prototype) { + prototype->SetClassName(mate::StringToV8(isolate, "WebContents")); + mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate()) .MakeDestroyable() .SetMethod("getId", &WebContents::GetID) .SetMethod("equal", &WebContents::Equal)