mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add initial Viz implementation for OSR (see issue #2575).
The old shared surface implementation has been removed and will need to be re-implemented using the Viz code path.
This commit is contained in:
committed by
Marshall Greenblatt
parent
cc0db5f166
commit
ac2cc54e13
52
libcef/browser/osr/software_output_device_proxy.h
Normal file
52
libcef/browser/osr/software_output_device_proxy.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef CEF_LIBCEF_BROWSER_OSR_SOFTWARE_OUTPUT_DEVICE_PROXY_H_
|
||||
#define CEF_LIBCEF_BROWSER_OSR_SOFTWARE_OUTPUT_DEVICE_PROXY_H_
|
||||
|
||||
#include "base/memory/shared_memory_mapping.h"
|
||||
#include "base/threading/thread_checker.h"
|
||||
#include "components/viz/service/display/software_output_device.h"
|
||||
#include "components/viz/service/viz_service_export.h"
|
||||
#include "services/viz/privileged/interfaces/compositing/display_private.mojom.h"
|
||||
#include "services/viz/privileged/interfaces/compositing/layered_window_updater.mojom.h"
|
||||
|
||||
namespace viz {
|
||||
|
||||
// SoftwareOutputDevice implementation that draws indirectly. An
|
||||
// implementation of mojom::LayeredWindowUpdater in the browser process
|
||||
// handles the actual drawing. Pixel backing is in SharedMemory so no copying
|
||||
// between processes is required.
|
||||
class VIZ_SERVICE_EXPORT SoftwareOutputDeviceProxy
|
||||
: public SoftwareOutputDevice {
|
||||
public:
|
||||
explicit SoftwareOutputDeviceProxy(
|
||||
mojom::LayeredWindowUpdaterPtr layered_window_updater);
|
||||
~SoftwareOutputDeviceProxy() override;
|
||||
|
||||
// SoftwareOutputDevice implementation.
|
||||
void OnSwapBuffers(SwapBuffersCallback swap_ack_callback) override;
|
||||
|
||||
// SoftwareOutputDeviceBase implementation.
|
||||
void Resize(const gfx::Size& viewport_pixel_size,
|
||||
float scale_factor) override;
|
||||
SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override;
|
||||
void EndPaint() override;
|
||||
|
||||
private:
|
||||
// Runs |swap_ack_callback_| after draw has happened.
|
||||
void DrawAck();
|
||||
|
||||
mojom::LayeredWindowUpdaterPtr layered_window_updater_;
|
||||
|
||||
std::unique_ptr<SkCanvas> canvas_;
|
||||
bool waiting_on_draw_ack_ = false;
|
||||
bool in_paint_ = false;
|
||||
base::OnceClosure swap_ack_callback_;
|
||||
base::WritableSharedMemoryMapping shm_;
|
||||
|
||||
THREAD_CHECKER(thread_checker_);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceProxy);
|
||||
};
|
||||
|
||||
} // namespace viz
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_OSR_SOFTWARE_OUTPUT_DEVICE_PROXY_H_
|
Reference in New Issue
Block a user