gpu acclereted osr added
This commit is contained in:
parent
5371921f8a
commit
96e1ba9c14
12 changed files with 812 additions and 198 deletions
|
@ -1206,12 +1206,30 @@ void WebContents::BeginFrameSubscription(mate::Arguments* args) {
|
|||
|
||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
||||
if (view) {
|
||||
std::unique_ptr<FrameSubscriber> frame_subscriber(new FrameSubscriber(
|
||||
isolate(), view, callback, only_dirty));
|
||||
view->BeginFrameSubscription(std::move(frame_subscriber));
|
||||
// std::unique_ptr<FrameSubscriber> frame_subscriber(new FrameSubscriber(
|
||||
// isolate(), view, callback, only_dirty));
|
||||
// view->BeginFrameSubscription(std::move(frame_subscriber));
|
||||
paint_isolate_ = args->isolate();
|
||||
|
||||
auto v = static_cast<OffScreenWindow *>(view);
|
||||
paint_callback_ = base::Bind(&WebContents::OnPaint,
|
||||
base::Unretained(this));
|
||||
v->SetPaintCallback(&paint_callback_);
|
||||
}
|
||||
}
|
||||
|
||||
void WebContents::OnPaint(
|
||||
const gfx::Rect& damage_rect,
|
||||
int bitmap_width,
|
||||
int bitmap_height,
|
||||
void* bitmap_pixels) {
|
||||
|
||||
v8::MaybeLocal<v8::Object> buffer = node::Buffer::New(paint_isolate_
|
||||
, (char *)bitmap_pixels, sizeof(bitmap_pixels));
|
||||
|
||||
Emit("paint", damage_rect, bitmap_width, bitmap_height, buffer.ToLocalChecked());
|
||||
}
|
||||
|
||||
void WebContents::EndFrameSubscription() {
|
||||
const auto view = web_contents()->GetRenderWidgetHostView();
|
||||
if (view)
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include "native_mate/handle.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
|
||||
#include "atom/browser/osr_window.h"
|
||||
|
||||
namespace blink {
|
||||
struct WebDeviceEmulationParams;
|
||||
}
|
||||
|
@ -142,6 +144,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
// Subscribe to the frame updates.
|
||||
void BeginFrameSubscription(mate::Arguments* args);
|
||||
void EndFrameSubscription();
|
||||
void OnPaint(const gfx::Rect&, int, int, void*);
|
||||
|
||||
// Dragging native items.
|
||||
void StartDrag(const mate::Dictionary& item, mate::Arguments* args);
|
||||
|
@ -278,6 +281,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
private:
|
||||
AtomBrowserContext* GetBrowserContext() const;
|
||||
|
||||
OffScreenWindow::OnPaintCallback paint_callback_;
|
||||
|
||||
uint32_t GetNextRequestId() {
|
||||
return ++request_id_;
|
||||
}
|
||||
|
@ -301,6 +306,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
v8::Global<v8::Value> devtools_web_contents_;
|
||||
v8::Global<v8::Value> debugger_;
|
||||
|
||||
v8::Isolate* paint_isolate_;
|
||||
|
||||
std::unique_ptr<WebViewGuestDelegate> guest_delegate_;
|
||||
|
||||
// The host webcontents that may contain this webcontents.
|
||||
|
|
|
@ -74,7 +74,8 @@ bool FrameSubscriber::ShouldCaptureFrame(
|
|||
base::Bind(&FrameSubscriber::ReadbackResultAsBitmap,
|
||||
base::Unretained(this)));
|
||||
|
||||
surface->RequestCopyOfOutput(std::move(request));
|
||||
// surface->RequestCopyOfOutput(std::move(request));
|
||||
std::cout << request.get() << surface << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue