summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h')
-rw-r--r--chromium/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h39
1 files changed, 30 insertions, 9 deletions
diff --git a/chromium/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h b/chromium/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h
index c4f0e99a8a9..9ac03f51f68 100644
--- a/chromium/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h
+++ b/chromium/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.h
@@ -37,6 +37,9 @@
#include "cc/layers/texture_layer_client.h"
#include "cc/resources/cross_thread_shared_bitmap.h"
#include "cc/resources/shared_bitmap_id_registrar.h"
+#include "gpu/GLES2/gl2extchromium.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
+#include "gpu/command_buffer/client/raster_interface.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/config/gpu_feature_info.h"
@@ -225,10 +228,7 @@ class PLATFORM_EXPORT DrawingBuffer : public cc::TextureLayerClient,
// contents of the front buffer. This is done without any pixel copies. The
// texture in the ImageBitmap is from the active ContextProvider on the
// DrawingBuffer.
- // If out_release_callback is null, the image is discarded. If it is non-null
- // the image must be recycled or discarded by calling *out_release_callback.
- scoped_refptr<StaticBitmapImage> TransferToStaticBitmapImage(
- std::unique_ptr<viz::SingleReleaseCallback>* out_release_callback);
+ scoped_refptr<StaticBitmapImage> TransferToStaticBitmapImage();
bool CopyToPlatformTexture(gpu::gles2::GLES2Interface*,
GLenum dst_target,
@@ -240,6 +240,14 @@ class PLATFORM_EXPORT DrawingBuffer : public cc::TextureLayerClient,
const IntRect& src_sub_rectangle,
SourceDrawingBuffer);
+ bool CopyToPlatformMailbox(gpu::raster::RasterInterface*,
+ gpu::Mailbox dst_mailbox,
+ GLenum dst_texture_target,
+ bool flip_y,
+ const IntPoint& dst_texture_offset,
+ const IntRect& src_sub_rectangle,
+ SourceDrawingBuffer src_buffer);
+
sk_sp<SkData> PaintRenderingResultsToDataArray(SourceDrawingBuffer);
int SampleCount() const { return sample_count_; }
@@ -345,18 +353,22 @@ class PLATFORM_EXPORT DrawingBuffer : public cc::TextureLayerClient,
bool pixel_pack_buffer_binding_dirty_ = false;
};
- struct ColorBuffer : public RefCounted<ColorBuffer> {
- ColorBuffer(DrawingBuffer*,
+ struct ColorBuffer : public base::RefCountedThreadSafe<ColorBuffer> {
+ ColorBuffer(base::WeakPtr<DrawingBuffer> drawing_buffer,
const IntSize&,
GLuint texture_id,
std::unique_ptr<gfx::GpuMemoryBuffer>,
gpu::Mailbox mailbox);
~ColorBuffer();
+ // The thread on which the ColorBuffer is created and the DrawingBuffer is
+ // bound to.
+ const base::PlatformThreadRef owning_thread_ref;
+
// The owning DrawingBuffer. Note that DrawingBuffer is explicitly destroyed
// by the beginDestruction method, which will eventually drain all of its
// ColorBuffers.
- scoped_refptr<DrawingBuffer> drawing_buffer;
+ base::WeakPtr<DrawingBuffer> drawing_buffer;
const IntSize size;
const GLuint texture_id = 0;
std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer;
@@ -385,6 +397,11 @@ class PLATFORM_EXPORT DrawingBuffer : public cc::TextureLayerClient,
DISALLOW_COPY_AND_ASSIGN(ColorBuffer);
};
+ template <typename CopyFunction>
+ bool CopyToPlatformInternal(gpu::InterfaceBase* dst_interface,
+ SourceDrawingBuffer src_buffer,
+ const CopyFunction& copy_function);
+
enum ClearOption { ClearOnlyMultisampledFBO, ClearAllFBOs };
// Clears out newly-allocated framebuffers (really, renderbuffers / textures).
@@ -420,8 +437,10 @@ class PLATFORM_EXPORT DrawingBuffer : public cc::TextureLayerClient,
// Callbacks for mailboxes given to the compositor from
// FinishPrepareTransferableResource{Gpu,Software}.
+ static void NotifyMailboxReleasedGpu(scoped_refptr<ColorBuffer>,
+ const gpu::SyncToken&,
+ bool lost_resource);
void MailboxReleasedGpu(scoped_refptr<ColorBuffer>,
- const gpu::SyncToken&,
bool lost_resource);
void MailboxReleasedSoftware(RegisteredBitmap,
const gpu::SyncToken&,
@@ -617,9 +636,11 @@ class PLATFORM_EXPORT DrawingBuffer : public cc::TextureLayerClient,
bool opengl_flip_y_extension_;
- gl::GpuPreference initial_gpu_;
+ const gl::GpuPreference initial_gpu_;
gl::GpuPreference current_active_gpu_;
+ base::WeakPtrFactory<DrawingBuffer> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(DrawingBuffer);
};