Commit ff2de642 authored by Chris Blume's avatar Chris Blume Committed by Commit Bot

Route correct context to SharedImageRepresentation

Currently, the wrong context is being used inside the
SharedImageRepresentations when using multiple contexts
across multiple threads.

This CL will route the correct context to each
SharedImageRepresentation.

Bug: 938594
Change-Id: I5c0e7583258f3e1c7256d39223b4c9b4b738b8ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1542785
Commit-Queue: Chris Blume <cblume@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646621}
parent e8eee094
......@@ -484,8 +484,8 @@ bool SkiaOutputSurfaceImplNonDDL::WaitSyncToken(
sk_sp<SkImage> SkiaOutputSurfaceImplNonDDL::MakeSkImageFromSharedImage(
const ResourceMetadata& metadata) {
auto representation =
sir_factory_->ProduceSkia(metadata.mailbox_holder.mailbox);
auto representation = sir_factory_->ProduceSkia(
metadata.mailbox_holder.mailbox, shared_context_state_.get());
if (!representation) {
DLOG(ERROR) << "Failed to make the SkImage - SharedImage mailbox not "
"found in SharedImageManager.";
......
......@@ -656,7 +656,7 @@ sk_sp<SkPromiseImageTexture> SkiaOutputSurfaceImplOnGpu::FulfillPromiseTexture(
if (!*shared_image_out && mailbox_holder.mailbox.IsSharedImage()) {
std::unique_ptr<gpu::SharedImageRepresentationSkia> shared_image =
shared_image_representation_factory_->ProduceSkia(
mailbox_holder.mailbox);
mailbox_holder.mailbox, context_state_.get());
if (!shared_image) {
DLOG(ERROR) << "Failed to fulfill the promise texture - SharedImage "
"mailbox not found in SharedImageManager.";
......
......@@ -218,11 +218,14 @@ ExternalVkImageBacking::ProduceGLTexturePassthrough(
}
std::unique_ptr<SharedImageRepresentationSkia>
ExternalVkImageBacking::ProduceSkia(SharedImageManager* manager,
MemoryTypeTracker* tracker) {
ExternalVkImageBacking::ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) {
// This backing type is only used when vulkan is enabled, so SkiaRenderer
// should also be using Vulkan.
DCHECK(context_state_->use_vulkan_gr_context());
DCHECK_EQ(context_state_, context_state.get());
DCHECK(context_state->use_vulkan_gr_context());
return std::make_unique<ExternalVkImageSkiaRepresentation>(manager, this,
tracker);
}
......
......@@ -8,6 +8,7 @@
#include <memory>
#include <vector>
#include "base/memory/scoped_refptr.h"
#include "components/viz/common/gpu/vulkan_context_provider.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image_backing.h"
......@@ -73,7 +74,8 @@ class ExternalVkImageBacking : public SharedImageBacking {
MemoryTypeTracker* tracker) override;
std::unique_ptr<SharedImageRepresentationSkia> ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker) override;
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) override;
private:
SharedContextState* const context_state_;
......
......@@ -2014,7 +2014,8 @@ void RasterDecoderImpl::DoBeginRasterCHROMIUM(
"generated by ProduceTextureCHROMIUM.";
DCHECK(!shared_image_);
shared_image_ = shared_image_representation_factory_.ProduceSkia(mailbox);
shared_image_ = shared_image_representation_factory_.ProduceSkia(
mailbox, shared_context_state_.get());
if (!shared_image_) {
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glBeginRasterCHROMIUM",
"passed invalid mailbox.");
......
......@@ -5,6 +5,7 @@
#include "gpu/command_buffer/service/shared_image_backing.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image_representation.h"
namespace gpu {
......@@ -54,7 +55,8 @@ SharedImageBacking::ProduceGLTexturePassthrough(SharedImageManager* manager,
std::unique_ptr<SharedImageRepresentationSkia> SharedImageBacking::ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker) {
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) {
return nullptr;
}
......
......@@ -6,6 +6,7 @@
#define GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_BACKING_H_
#include "base/containers/flat_map.h"
#include "base/memory/scoped_refptr.h"
#include "base/optional.h"
#include "base/synchronization/lock.h"
#include "components/viz/common/resources/resource_format.h"
......@@ -23,6 +24,7 @@ class MemoryAllocatorDump;
namespace gpu {
class MailboxManager;
class SharedContextState;
class SharedImageManager;
class SharedImageRepresentation;
class SharedImageRepresentationGLTexture;
......@@ -96,7 +98,8 @@ class GPU_GLES2_EXPORT SharedImageBacking {
MemoryTypeTracker* tracker);
virtual std::unique_ptr<SharedImageRepresentationSkia> ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker);
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state);
// Used by subclasses in Destroy.
bool have_context() const;
......
......@@ -16,6 +16,7 @@
#include "base/android/scoped_hardware_buffer_handle.h"
#include "base/containers/flat_set.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "components/viz/common/gpu/vulkan_context_provider.h"
#include "components/viz/common/resources/resource_format_utils.h"
#include "components/viz/common/resources/resource_sizes.h"
......@@ -190,7 +191,6 @@ class SharedImageBackingAHB : public SharedImageBacking {
uint32_t usage,
base::android::ScopedHardwareBufferHandle handle,
size_t estimated_size,
SharedContextState* context_state,
bool is_thread_safe);
~SharedImageBackingAHB() override;
......@@ -200,7 +200,6 @@ class SharedImageBackingAHB : public SharedImageBacking {
void Update() override;
bool ProduceLegacyMailbox(MailboxManager* mailbox_manager) override;
void Destroy() override;
SharedContextState* GetContextState() const;
base::android::ScopedHardwareBufferHandle GetAhbHandle() const;
bool BeginWrite(std::vector<base::ScopedFD>* fds_to_wait_on);
......@@ -217,7 +216,8 @@ class SharedImageBackingAHB : public SharedImageBacking {
std::unique_ptr<SharedImageRepresentationSkia> ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker) override;
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) override;
private:
gles2::Texture* GenGLTexture();
......@@ -226,7 +226,6 @@ class SharedImageBackingAHB : public SharedImageBacking {
gles2::Texture* legacy_texture_ = nullptr;
bool is_cleared_ = false;
SharedContextState* const context_state_ = nullptr;
// All reads and writes must wait for exiting writes to complete.
base::ScopedFD write_sync_fd_;
......@@ -452,13 +451,15 @@ class SharedImageRepresentationSkiaGLAHB
class SharedImageRepresentationSkiaVkAHB
: public SharedImageRepresentationSkia {
public:
SharedImageRepresentationSkiaVkAHB(SharedImageManager* manager,
SharedImageBacking* backing)
: SharedImageRepresentationSkia(manager, backing, nullptr) {
SharedImageRepresentationSkiaVkAHB(
SharedImageManager* manager,
SharedImageBacking* backing,
scoped_refptr<SharedContextState> context_state)
: SharedImageRepresentationSkia(manager, backing, nullptr),
context_state_(context_state) {
SharedImageBackingAHB* ahb_backing =
static_cast<SharedImageBackingAHB*>(backing);
DCHECK(ahb_backing);
context_state_ = ahb_backing->GetContextState();
DCHECK(context_state_);
DCHECK(context_state_->vk_context_provider());
}
......@@ -656,7 +657,7 @@ class SharedImageRepresentationSkiaVkAHB
sk_sp<SkPromiseImageTexture> promise_texture_;
RepresentationAccessMode mode_ = RepresentationAccessMode::kNone;
SkSurface* surface_ = nullptr;
SharedContextState* context_state_ = nullptr;
scoped_refptr<SharedContextState> context_state_ = nullptr;
};
SharedImageBackingAHB::SharedImageBackingAHB(
......@@ -667,7 +668,6 @@ SharedImageBackingAHB::SharedImageBackingAHB(
uint32_t usage,
base::android::ScopedHardwareBufferHandle handle,
size_t estimated_size,
SharedContextState* context_state,
bool is_thread_safe)
: SharedImageBacking(mailbox,
format,
......@@ -676,8 +676,7 @@ SharedImageBackingAHB::SharedImageBackingAHB(
usage,
estimated_size,
is_thread_safe),
hardware_buffer_handle_(std::move(handle)),
context_state_(context_state) {
hardware_buffer_handle_(std::move(handle)) {
DCHECK(hardware_buffer_handle_.is_valid());
}
......@@ -728,10 +727,6 @@ void SharedImageBackingAHB::Destroy() {
hardware_buffer_handle_.reset();
}
SharedContextState* SharedImageBackingAHB::GetContextState() const {
return context_state_;
}
base::android::ScopedHardwareBufferHandle SharedImageBackingAHB::GetAhbHandle()
const {
AutoLock auto_lock(this);
......@@ -753,14 +748,18 @@ SharedImageBackingAHB::ProduceGLTexture(SharedImageManager* manager,
}
std::unique_ptr<SharedImageRepresentationSkia>
SharedImageBackingAHB::ProduceSkia(SharedImageManager* manager,
MemoryTypeTracker* tracker) {
DCHECK(context_state_);
SharedImageBackingAHB::ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) {
DCHECK(context_state);
// Check whether we are in Vulkan mode OR GL mode and accordingly create
// Skia representation.
if (context_state_->use_vulkan_gr_context())
return std::make_unique<SharedImageRepresentationSkiaVkAHB>(manager, this);
if (context_state->use_vulkan_gr_context()) {
return std::make_unique<SharedImageRepresentationSkiaVkAHB>(manager, this,
context_state);
}
auto* texture = GenGLTexture();
if (!texture)
......@@ -921,9 +920,7 @@ gles2::Texture* SharedImageBackingAHB::GenGLTexture() {
SharedImageBackingFactoryAHB::SharedImageBackingFactoryAHB(
const GpuDriverBugWorkarounds& workarounds,
const GpuFeatureInfo& gpu_feature_info,
SharedContextState* context_state)
: context_state_(context_state) {
const GpuFeatureInfo& gpu_feature_info) {
scoped_refptr<gles2::FeatureInfo> feature_info =
new gles2::FeatureInfo(workarounds, gpu_feature_info);
feature_info->Initialize(ContextType::CONTEXT_TYPE_OPENGLES2, false,
......@@ -1086,7 +1083,7 @@ SharedImageBackingFactoryAHB::CreateSharedImage(
auto backing = std::make_unique<SharedImageBackingAHB>(
mailbox, format, size, color_space, usage,
base::android::ScopedHardwareBufferHandle::Adopt(buffer), estimated_size,
context_state_, is_thread_safe);
is_thread_safe);
return backing;
}
......
......@@ -17,7 +17,6 @@ class ColorSpace;
} // namespace gfx
namespace gpu {
class SharedContextState;
class SharedImageBacking;
class GpuDriverBugWorkarounds;
struct GpuFeatureInfo;
......@@ -29,8 +28,7 @@ class GPU_GLES2_EXPORT SharedImageBackingFactoryAHB
: public SharedImageBackingFactory {
public:
SharedImageBackingFactoryAHB(const GpuDriverBugWorkarounds& workarounds,
const GpuFeatureInfo& gpu_feature_info,
SharedContextState* context_state);
const GpuFeatureInfo& gpu_feature_info);
~SharedImageBackingFactoryAHB() override;
// SharedImageBackingFactory implementation.
......@@ -80,7 +78,6 @@ class GPU_GLES2_EXPORT SharedImageBackingFactoryAHB
// Used to limit the max size of AHardwareBuffer.
int32_t max_gl_texture_size_ = 0;
SharedContextState* context_state_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(SharedImageBackingFactoryAHB);
};
......
......@@ -62,7 +62,7 @@ class SharedImageBackingFactoryAHBTest : public testing::Test {
context_state_->InitializeGL(GpuPreferences(), std::move(feature_info));
backing_factory_ = std::make_unique<SharedImageBackingFactoryAHB>(
workarounds, GpuFeatureInfo(), context_state_.get());
workarounds, GpuFeatureInfo());
memory_type_tracker_ = std::make_unique<MemoryTypeTracker>(nullptr);
shared_image_representation_factory_ =
......@@ -118,7 +118,7 @@ TEST_F(SharedImageBackingFactoryAHBTest, Basic) {
// Finally, validate a SharedImageRepresentationSkia.
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
gl_legacy_shared_image.mailbox());
gl_legacy_shared_image.mailbox(), context_state_.get());
EXPECT_TRUE(skia_representation);
auto surface = skia_representation->BeginWriteAccess(
gr_context(), 0, SkSurfaceProps(0, kUnknown_SkPixelGeometry));
......@@ -184,8 +184,8 @@ TEST_F(SharedImageBackingFactoryAHBTest, GLSkiaGL) {
gl_representation.reset();
// Next create a SharedImageRepresentationSkia to read back the texture data.
auto skia_representation =
shared_image_representation_factory_->ProduceSkia(mailbox);
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
mailbox, context_state_.get());
EXPECT_TRUE(skia_representation);
auto promise_texture = skia_representation->BeginReadAccess(nullptr);
EXPECT_TRUE(promise_texture);
......@@ -294,7 +294,7 @@ TEST_F(SharedImageBackingFactoryAHBTest, OnlyOneWriter) {
memory_type_tracker_.get(), shared_image_representation_factory_.get()};
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
gl_legacy_shared_image.mailbox());
gl_legacy_shared_image.mailbox(), context_state_.get());
auto surface = skia_representation->BeginWriteAccess(
gr_context(), 0, SkSurfaceProps(0, kUnknown_SkPixelGeometry));
......@@ -316,9 +316,9 @@ TEST_F(SharedImageBackingFactoryAHBTest, CanHaveMultipleReaders) {
memory_type_tracker_.get(), shared_image_representation_factory_.get()};
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
gl_legacy_shared_image.mailbox());
gl_legacy_shared_image.mailbox(), context_state_.get());
auto skia_representation2 = shared_image_representation_factory_->ProduceSkia(
gl_legacy_shared_image.mailbox());
gl_legacy_shared_image.mailbox(), context_state_.get());
sk_sp<SkSurface> surface =
SkSurface::MakeNull(gl_legacy_shared_image.size().width(),
......@@ -347,7 +347,7 @@ TEST_F(SharedImageBackingFactoryAHBTest,
memory_type_tracker_.get(), shared_image_representation_factory_.get()};
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
gl_legacy_shared_image.mailbox());
gl_legacy_shared_image.mailbox(), context_state_.get());
sk_sp<SkSurface> surface =
SkSurface::MakeNull(gl_legacy_shared_image.size().width(),
gl_legacy_shared_image.size().height());
......@@ -372,7 +372,7 @@ TEST_F(SharedImageBackingFactoryAHBTest, CannotWriteWhileReading) {
memory_type_tracker_.get(), shared_image_representation_factory_.get()};
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
gl_legacy_shared_image.mailbox());
gl_legacy_shared_image.mailbox(), context_state_.get());
sk_sp<SkSurface> surface =
SkSurface::MakeNull(gl_legacy_shared_image.size().width(),
gl_legacy_shared_image.size().height());
......@@ -396,7 +396,7 @@ TEST_F(SharedImageBackingFactoryAHBTest, CannotReadWhileWriting) {
memory_type_tracker_.get(), shared_image_representation_factory_.get()};
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
gl_legacy_shared_image.mailbox());
gl_legacy_shared_image.mailbox(), context_state_.get());
auto surface = skia_representation->BeginWriteAccess(
gr_context(), 0, SkSurfaceProps(0, kUnknown_SkPixelGeometry));
......
......@@ -20,6 +20,7 @@
#include "gpu/command_buffer/service/image_factory.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/service_utils.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image_backing.h"
#include "gpu/command_buffer/service/shared_image_representation.h"
#include "gpu/command_buffer/service/skia_utils.h"
......@@ -520,7 +521,8 @@ class SharedImageBackingGLTexture : public SharedImageBackingWithReadAccess {
std::unique_ptr<SharedImageRepresentationSkia> ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker) override {
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) override {
auto result = std::make_unique<SharedImageRepresentationSkiaImpl>(
manager, this, cached_promise_texture_, tracker, texture_->target(),
texture_->service_id());
......@@ -628,7 +630,8 @@ class SharedImageBackingPassthroughGLTexture
}
std::unique_ptr<SharedImageRepresentationSkia> ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker) override {
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) override {
auto result = std::make_unique<SharedImageRepresentationSkiaImpl>(
manager, this, cached_promise_texture_, tracker,
texture_passthrough_->target(), texture_passthrough_->service_id());
......
......@@ -177,8 +177,8 @@ TEST_P(SharedImageBackingFactoryGLTextureTest, Basic) {
}
// Finally, validate a SharedImageRepresentationSkia.
auto skia_representation =
shared_image_representation_factory_->ProduceSkia(mailbox);
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
mailbox, context_state_.get());
EXPECT_TRUE(skia_representation);
auto surface = skia_representation->BeginWriteAccess(
gr_context(), 0, SkSurfaceProps(0, kUnknown_SkPixelGeometry));
......@@ -276,8 +276,8 @@ TEST_P(SharedImageBackingFactoryGLTextureTest, Image) {
}
// Finally, validate a SharedImageRepresentationSkia.
auto skia_representation =
shared_image_representation_factory_->ProduceSkia(mailbox);
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
mailbox, context_state_.get());
EXPECT_TRUE(skia_representation);
auto surface = skia_representation->BeginWriteAccess(
gr_context(), 0, SkSurfaceProps(0, kUnknown_SkPixelGeometry));
......
......@@ -5,6 +5,7 @@
#include "gpu/command_buffer/service/shared_image_backing_factory_iosurface.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/memory/scoped_refptr.h"
#include "components/viz/common/resources/resource_format_utils.h"
#include "components/viz/common/resources/resource_sizes.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
......@@ -228,7 +229,8 @@ class SharedImageBackingIOSurface : public SharedImageBacking {
std::unique_ptr<SharedImageRepresentationSkia> ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker) override {
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) override {
gles2::Texture* texture = GenGLTexture();
if (!texture) {
return nullptr;
......
......@@ -126,8 +126,8 @@ TEST_F(SharedImageBackingFactoryIOSurfaceTest, Basic) {
gl_representation.reset();
// Finally, validate a SharedImageRepresentationSkia.
auto skia_representation =
shared_image_representation_factory_->ProduceSkia(mailbox);
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
mailbox, context_state_);
EXPECT_TRUE(skia_representation);
auto surface = skia_representation->BeginWriteAccess(
gr_context(), 0, SkSurfaceProps(0, kUnknown_SkPixelGeometry));
......@@ -193,8 +193,8 @@ TEST_F(SharedImageBackingFactoryIOSurfaceTest, GLSkiaGL) {
gl_representation.reset();
// Next create a SharedImageRepresentationSkia to read back the texture data.
auto skia_representation =
shared_image_representation_factory_->ProduceSkia(mailbox);
auto skia_representation = shared_image_representation_factory_->ProduceSkia(
mailbox, context_state_);
EXPECT_TRUE(skia_representation);
auto promise_texture = skia_representation->BeginReadAccess(nullptr);
EXPECT_TRUE(promise_texture);
......
......@@ -78,7 +78,7 @@ SharedImageFactory::SharedImageFactory(
#elif defined(OS_ANDROID) && BUILDFLAG(ENABLE_VULKAN)
// For Android
interop_backing_factory_ = std::make_unique<SharedImageBackingFactoryAHB>(
workarounds, gpu_feature_info, context_state);
workarounds, gpu_feature_info);
#elif defined(OS_MACOSX)
// OSX
DCHECK(!using_vulkan_);
......@@ -295,8 +295,10 @@ SharedImageRepresentationFactory::ProduceGLTexturePassthrough(
}
std::unique_ptr<SharedImageRepresentationSkia>
SharedImageRepresentationFactory::ProduceSkia(const Mailbox& mailbox) {
return manager_->ProduceSkia(mailbox, tracker_.get());
SharedImageRepresentationFactory::ProduceSkia(
const Mailbox& mailbox,
scoped_refptr<SharedContextState> context_state) {
return manager_->ProduceSkia(mailbox, tracker_.get(), context_state);
}
} // namespace gpu
......@@ -118,7 +118,8 @@ class GPU_GLES2_EXPORT SharedImageRepresentationFactory {
std::unique_ptr<SharedImageRepresentationGLTexturePassthrough>
ProduceGLTexturePassthrough(const Mailbox& mailbox);
std::unique_ptr<SharedImageRepresentationSkia> ProduceSkia(
const Mailbox& mailbox);
const Mailbox& mailbox,
scoped_refptr<SharedContextState> context_State);
private:
SharedImageManager* manager_;
......
......@@ -14,6 +14,7 @@
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/common/shared_image_trace_utils.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image_representation.h"
#include "ui/gl/trace_util.h"
......@@ -175,7 +176,8 @@ SharedImageManager::ProduceGLTexturePassthrough(const Mailbox& mailbox,
std::unique_ptr<SharedImageRepresentationSkia> SharedImageManager::ProduceSkia(
const Mailbox& mailbox,
MemoryTypeTracker* tracker) {
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) {
CALLED_ON_VALID_THREAD();
AutoLock autolock(this);
......@@ -186,7 +188,7 @@ std::unique_ptr<SharedImageRepresentationSkia> SharedImageManager::ProduceSkia(
return nullptr;
}
auto representation = (*found)->ProduceSkia(this, tracker);
auto representation = (*found)->ProduceSkia(this, tracker, context_state);
if (!representation) {
LOG(ERROR) << "SharedImageManager::ProduceSkia: Trying to produce a "
"Skia representation from an incompatible mailbox.";
......
......@@ -6,6 +6,7 @@
#define GPU_COMMAND_BUFFER_SERVICE_SHARED_IMAGE_MANAGER_H_
#include "base/containers/flat_set.h"
#include "base/memory/scoped_refptr.h"
#include "base/optional.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
......@@ -43,7 +44,8 @@ class GPU_GLES2_EXPORT SharedImageManager {
ProduceGLTexturePassthrough(const Mailbox& mailbox, MemoryTypeTracker* ref);
std::unique_ptr<SharedImageRepresentationSkia> ProduceSkia(
const Mailbox& mailbox,
MemoryTypeTracker* ref);
MemoryTypeTracker* ref,
scoped_refptr<SharedContextState> context_state);
// Called by SharedImageRepresentation in the destructor.
void OnRepresentationDestroyed(const Mailbox& mailbox,
......
......@@ -6,6 +6,7 @@
#include "base/hash/hash.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h"
......@@ -88,7 +89,8 @@ class WrappedSkImage : public SharedImageBacking {
protected:
std::unique_ptr<SharedImageRepresentationSkia> ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker) override;
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) override;
private:
friend class gpu::raster::WrappedSkImageFactory;
......@@ -278,7 +280,9 @@ std::unique_ptr<SharedImageBacking> WrappedSkImageFactory::CreateSharedImage(
std::unique_ptr<SharedImageRepresentationSkia> WrappedSkImage::ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker) {
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) {
DCHECK_EQ(context_state_, context_state.get());
return std::make_unique<WrappedSkImageRepresentation>(manager, this, tracker);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment