Add support for begin frame scheduling and direct rendering when GPU compositing is disabled (issue #1368).

- Always set the browser process VSync rate (frame rate) to CefSettings.windowless_frame_rate.
- When the `enable-begin-frame-scheduling` command-line flag is specified the VSync rate for all processes will be synchronized to CefSettings.windowless_frame_rate. This flag cannot be used in combination with windowed rendering.
- When the `disable-gpu` and `disable-gpu-compositing` command-line flags are specified the CefRenderHandler::OnPaint method will be called directly from the compositor instead of requiring an additional copy for each frame.
- CefRenderHandler::OnPopupSize now passes view coordinates instead of (potentially scaled) pixel coordinates.
- Add OSR unit tests for 2x (HiDPI) pixel scaling.
- Improve CefRenderHandler documentation.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1960 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2015-01-01 16:51:56 +00:00
parent 3aec2e1a72
commit d0a45cfbbb
12 changed files with 1016 additions and 457 deletions

View File

@ -0,0 +1,67 @@
diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc
index 33b3aa0..801598c 100644
--- content/browser/compositor/gpu_process_transport_factory.cc
+++ content/browser/compositor/gpu_process_transport_factory.cc
@@ -106,6 +106,13 @@ GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() {
scoped_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
ui::Compositor* compositor) {
+ if (compositor->delegate()) {
+ scoped_ptr<cc::SoftwareOutputDevice> output_device =
+ compositor->delegate()->CreateSoftwareOutputDevice(compositor);
+ if (output_device.get())
+ return output_device;
+ }
+
#if defined(OS_WIN)
return scoped_ptr<cc::SoftwareOutputDevice>(new SoftwareOutputDeviceWin(
compositor));
diff --git ui/compositor/compositor.h ui/compositor/compositor.h
index 5d9d793..da20f14 100644
--- ui/compositor/compositor.h
+++ ui/compositor/compositor.h
@@ -13,6 +13,7 @@
#include "base/observer_list.h"
#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
+#include "cc/output/software_output_device.h"
#include "cc/surfaces/surface_sequence.h"
#include "cc/trees/layer_tree_host_client.h"
#include "cc/trees/layer_tree_host_single_thread_client.h"
@@ -136,6 +137,17 @@ class COMPOSITOR_EXPORT CompositorLock
DISALLOW_COPY_AND_ASSIGN(CompositorLock);
};
+class COMPOSITOR_EXPORT CompositorDelegate {
+ public:
+ virtual scoped_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
+ ui::Compositor* compositor) {
+ return scoped_ptr<cc::SoftwareOutputDevice>();
+ }
+
+ protected:
+ virtual ~CompositorDelegate() {}
+};
+
// Compositor object to take care of GPU painting.
// A Browser compositor object is responsible for generating the final
// displayable form of pixels comprising a single widget's contents. It draws an
@@ -157,6 +169,9 @@ class COMPOSITOR_EXPORT Compositor
// Schedules a redraw of the layer tree associated with this compositor.
void ScheduleDraw();
+ CompositorDelegate* delegate() const { return delegate_; }
+ void SetDelegate(CompositorDelegate* delegate) { delegate_ = delegate; }
+
// Sets the root of the layer tree drawn by this Compositor. The root layer
// must have no parent. The compositor's root layer is reset if the root layer
// is destroyed. NULL can be passed to reset the root layer, in which case the
@@ -304,6 +319,8 @@ class COMPOSITOR_EXPORT Compositor
ui::ContextFactory* context_factory_;
+ CompositorDelegate* delegate_ = nullptr;
+
// The root of the Layer tree drawn by this compositor.
Layer* root_layer_;