Browse Source

DelegatedFrameHost API changed

https://chromium-review.googlesource.com/c/chromium/src/+/1594924
Jeremy Apthorp 6 years ago
parent
commit
79f62cc1aa

+ 2 - 1
atom/browser/api/atom_api_web_contents.cc

@@ -50,6 +50,7 @@
 #include "atom/common/options_switches.h"
 #include "base/message_loop/message_loop.h"
 #include "base/no_destructor.h"
+#include "base/optional.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/threading/thread_restrictions.h"
 #include "base/threading/thread_task_runner_handle.h"
@@ -1216,7 +1217,7 @@ void WebContents::SetBackgroundThrottling(bool allowed) {
   render_widget_host_impl->disable_hidden_ = !background_throttling_;
 
   if (render_widget_host_impl->is_hidden()) {
-    render_widget_host_impl->WasShown(false);
+    render_widget_host_impl->WasShown(base::nullopt);
   }
 }
 

+ 3 - 2
atom/browser/osr/osr_render_widget_host_view.cc

@@ -12,6 +12,7 @@
 #include "base/callback_helpers.h"
 #include "base/location.h"
 #include "base/memory/ptr_util.h"
+#include "base/optional.h"
 #include "base/single_thread_task_runner.h"
 #include "base/task/post_task.h"
 #include "base/time/time.h"
@@ -383,10 +384,10 @@ void OffScreenRenderWidgetHostView::Show() {
   delegated_frame_host_->AttachToCompositor(compositor_.get());
   delegated_frame_host_->WasShown(
       GetLocalSurfaceIdAllocation().local_surface_id(),
-      GetRootLayer()->bounds().size(), false);
+      GetRootLayer()->bounds().size(), base::nullopt);
 
   if (render_widget_host_)
-    render_widget_host_->WasShown(false);
+    render_widget_host_->WasShown(base::nullopt);
 }
 
 void OffScreenRenderWidgetHostView::Hide() {

+ 9 - 8
patches/common/chromium/feat_offscreen_rendering_with_viz_compositor.patch

@@ -177,10 +177,10 @@ index f3867356e3d641416e00e6d115ae9ae2a0be90ab..b1d192d2b20ccb63fba07093101d745e
  
 diff --git a/components/viz/service/display_embedder/software_output_device_proxy.cc b/components/viz/service/display_embedder/software_output_device_proxy.cc
 new file mode 100644
-index 0000000000000000000000000000000000000000..c784a841f74e7a6215595fd8b1166655857f3e31
+index 0000000000000000000000000000000000000000..bbca3a43b5ba8bcf1e3a4dab4509b903b7117f36
 --- /dev/null
 +++ b/components/viz/service/display_embedder/software_output_device_proxy.cc
-@@ -0,0 +1,167 @@
+@@ -0,0 +1,168 @@
 +// Copyright 2014 The Chromium Authors. All rights reserved.
 +// Use of this source code is governed by a BSD-style license that can be
 +// found in the LICENSE file.
@@ -257,12 +257,13 @@ index 0000000000000000000000000000000000000000..c784a841f74e7a6215595fd8b1166655
 +}
 +
 +void SoftwareOutputDeviceProxy::OnSwapBuffers(
-+    base::OnceClosure swap_ack_callback) {
++    SoftwareOutputDevice::SwapBuffersCallback swap_ack_callback) {
 +  DCHECK(swap_ack_callback_.is_null());
 +
 +  // We aren't waiting on DrawAck() and can immediately run the callback.
 +  if (!waiting_on_draw_ack_) {
-+    task_runner_->PostTask(FROM_HERE, std::move(swap_ack_callback));
++    task_runner_->PostTask(FROM_HERE,
++        base::BindOnce(std::move(swap_ack_callback), viewport_pixel_size_));
 +    return;
 +  }
 +
@@ -344,13 +345,13 @@ index 0000000000000000000000000000000000000000..c784a841f74e7a6215595fd8b1166655
 +  TRACE_EVENT_ASYNC_END0("viz", "SoftwareOutputDeviceProxy::Draw", this);
 +
 +  waiting_on_draw_ack_ = false;
-+  std::move(swap_ack_callback_).Run();
++  std::move(swap_ack_callback_).Run(viewport_pixel_size_);
 +}
 +
 +}  // namespace viz
 diff --git a/components/viz/service/display_embedder/software_output_device_proxy.h b/components/viz/service/display_embedder/software_output_device_proxy.h
 new file mode 100644
-index 0000000000000000000000000000000000000000..01e1e2f0860faa1afe42c342c8905a7f838bd363
+index 0000000000000000000000000000000000000000..ff3c0217812a8370a20aa528f117e928fd1b95f4
 --- /dev/null
 +++ b/components/viz/service/display_embedder/software_output_device_proxy.h
 @@ -0,0 +1,88 @@
@@ -415,7 +416,7 @@ index 0000000000000000000000000000000000000000..01e1e2f0860faa1afe42c342c8905a7f
 +  ~SoftwareOutputDeviceProxy() override;
 +
 +  // SoftwareOutputDevice implementation.
-+  void OnSwapBuffers(base::OnceClosure swap_ack_callback) override;
++  void OnSwapBuffers(SoftwareOutputDevice::SwapBuffersCallback swap_ack_callback) override;
 +
 +  // SoftwareOutputDeviceBase implementation.
 +  void ResizeDelegated() override;
@@ -430,7 +431,7 @@ index 0000000000000000000000000000000000000000..01e1e2f0860faa1afe42c342c8905a7f
 +
 +  std::unique_ptr<SkCanvas> canvas_;
 +  bool waiting_on_draw_ack_ = false;
-+  base::OnceClosure swap_ack_callback_;
++  SoftwareOutputDevice::SwapBuffersCallback swap_ack_callback_;
 +
 +#if !defined(WIN32)
 +  base::WritableSharedMemoryMapping shm_mapping_;