78 строки
3.6 KiB
Diff
78 строки
3.6 KiB
Diff
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.cc b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
|
|
index fc5197ab84e9..caafd63c0219 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_child_frame.cc
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_child_frame.cc
|
|
@@ -31,12 +31,14 @@
|
|
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
|
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
|
|
#include "content/browser/renderer_host/render_widget_host_view_event_handler.h"
|
|
+#include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h"
|
|
#include "content/browser/renderer_host/text_input_manager.h"
|
|
#include "content/common/text_input_state.h"
|
|
#include "content/common/view_messages.h"
|
|
#include "content/public/browser/guest_mode.h"
|
|
#include "content/public/browser/render_process_host.h"
|
|
#include "gpu/ipc/common/gpu_messages.h"
|
|
+#include "media/base/video_frame.h"
|
|
#include "services/service_manager/runner/common/client_util.h"
|
|
#include "third_party/WebKit/public/platform/WebTouchEvent.h"
|
|
#include "ui/gfx/geometry/size_conversions.h"
|
|
@@ -931,6 +933,30 @@ void RenderWidgetHostViewChildFrame::ResetCompositorFrameSinkSupport() {
|
|
support_.reset();
|
|
}
|
|
|
|
+void RenderWidgetHostViewChildFrame::WillDrawSurface(
|
|
+ const viz::LocalSurfaceId& local_surface_id,
|
|
+ const gfx::Rect& damage_rect) {
|
|
+ if (local_surface_id != local_surface_id_ ||
|
|
+ damage_rect.IsEmpty() ||
|
|
+ !frame_subscriber_.get())
|
|
+ return;
|
|
+
|
|
+ base::TimeTicks present_time;
|
|
+ scoped_refptr<media::VideoFrame> frame;
|
|
+ RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback;
|
|
+ frame_subscriber_->ShouldCaptureFrame(damage_rect, present_time, &frame,
|
|
+ &callback);
|
|
+}
|
|
+
|
|
+void RenderWidgetHostViewChildFrame::BeginFrameSubscription(
|
|
+ std::unique_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) {
|
|
+ frame_subscriber_ = std::move(subscriber);
|
|
+}
|
|
+
|
|
+void RenderWidgetHostViewChildFrame::EndFrameSubscription() {
|
|
+ frame_subscriber_.reset();
|
|
+}
|
|
+
|
|
bool RenderWidgetHostViewChildFrame::HasEmbedderChanged() {
|
|
return false;
|
|
}
|
|
diff --git a/content/browser/renderer_host/render_widget_host_view_child_frame.h b/content/browser/renderer_host/render_widget_host_view_child_frame.h
|
|
index e994ab27f966..306d30f51ffe 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_child_frame.h
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_child_frame.h
|
|
@@ -180,8 +180,11 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
|
|
void OnBeginFrame(const viz::BeginFrameArgs& args) override;
|
|
void ReclaimResources(
|
|
const std::vector<viz::ReturnedResource>& resources) override;
|
|
- void WillDrawSurface(const viz::LocalSurfaceId& id,
|
|
- const gfx::Rect& damage_rect) override {}
|
|
+ void WillDrawSurface(const viz::LocalSurfaceId& local_surface_id,
|
|
+ const gfx::Rect& damage_rect) override;
|
|
+ void BeginFrameSubscription(
|
|
+ std::unique_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override;
|
|
+ void EndFrameSubscription() override;
|
|
void OnBeginFramePausedChanged(bool paused) override;
|
|
|
|
// viz::HostFrameSinkClient implementation.
|
|
@@ -302,6 +305,8 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
|
|
// The surface client ID of the parent RenderWidgetHostView. 0 if none.
|
|
viz::FrameSinkId parent_frame_sink_id_;
|
|
|
|
+ std::unique_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_;
|
|
+
|
|
bool has_frame_ = false;
|
|
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_ =
|
|
nullptr;
|