summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android_webview/browser/aw_render_thread_context_provider.cc13
-rw-r--r--android_webview/browser/aw_render_thread_context_provider.h3
-rw-r--r--blimp/client/compositor/blimp_context_provider.cc15
-rw-r--r--blimp/client/compositor/blimp_context_provider.h4
-rw-r--r--cc/output/context_provider.h5
-rw-r--r--cc/raster/tile_task_worker_pool_perftest.cc1
-rw-r--r--cc/test/test_context_provider.cc21
-rw-r--r--cc/test/test_context_provider.h4
-rw-r--r--cc/test/test_in_process_context_provider.cc2
-rw-r--r--cc/test/test_in_process_context_provider.h1
-rw-r--r--components/mus/public/cpp/context_provider.h1
-rw-r--r--components/mus/public/cpp/lib/context_provider.cc4
-rw-r--r--components/mus/surfaces/surfaces_context_provider.cc4
-rw-r--r--components/mus/surfaces/surfaces_context_provider.h1
-rw-r--r--content/browser/android/in_process/context_provider_in_process.cc14
-rw-r--r--content/browser/android/in_process/context_provider_in_process.h4
-rw-r--r--content/common/gpu/client/context_provider_command_buffer.cc19
-rw-r--r--content/common/gpu/client/context_provider_command_buffer.h4
-rw-r--r--content/renderer/render_thread_impl.cc3
-rw-r--r--ui/compositor/test/in_process_context_factory.cc5
-rw-r--r--ui/compositor/test/in_process_context_provider.cc16
-rw-r--r--ui/compositor/test/in_process_context_provider.h4
22 files changed, 9 insertions, 139 deletions
diff --git a/android_webview/browser/aw_render_thread_context_provider.cc b/android_webview/browser/aw_render_thread_context_provider.cc
index 3ead8ec..937d12e 100644
--- a/android_webview/browser/aw_render_thread_context_provider.cc
+++ b/android_webview/browser/aw_render_thread_context_provider.cc
@@ -47,8 +47,7 @@ AwRenderThreadContextProvider::Create(
AwRenderThreadContextProvider::AwRenderThreadContextProvider(
scoped_refptr<gfx::GLSurface> surface,
- scoped_refptr<gpu::InProcessCommandBuffer::Service> service)
- : destroyed_(false) {
+ scoped_refptr<gpu::InProcessCommandBuffer::Service> service) {
DCHECK(main_thread_checker_.CalledOnValidThread());
blink::WebGraphicsContext3D::Attributes attributes;
@@ -170,12 +169,6 @@ void AwRenderThreadContextProvider::DeleteCachedResources() {
}
}
-bool AwRenderThreadContextProvider::DestroyedOnMainThread() {
- DCHECK(main_thread_checker_.CalledOnValidThread());
-
- return destroyed_;
-}
-
void AwRenderThreadContextProvider::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {
lost_context_callback_ = lost_context_callback;
@@ -184,10 +177,6 @@ void AwRenderThreadContextProvider::SetLostContextCallback(
void AwRenderThreadContextProvider::OnLostContext() {
DCHECK(main_thread_checker_.CalledOnValidThread());
- if (destroyed_)
- return;
- destroyed_ = true;
-
if (!lost_context_callback_.is_null())
base::ResetAndReturn(&lost_context_callback_).Run();
if (gr_context_)
diff --git a/android_webview/browser/aw_render_thread_context_provider.h b/android_webview/browser/aw_render_thread_context_provider.h
index 41a7a6c..da30c9e 100644
--- a/android_webview/browser/aw_render_thread_context_provider.h
+++ b/android_webview/browser/aw_render_thread_context_provider.h
@@ -46,7 +46,6 @@ class AwRenderThreadContextProvider : public cc::ContextProvider {
base::Lock* GetLock() override;
void VerifyContexts() override;
void DeleteCachedResources() override;
- bool DestroyedOnMainThread() override;
void SetLostContextCallback(
const LostContextCallback& lost_context_callback) override;
@@ -61,8 +60,6 @@ class AwRenderThreadContextProvider : public cc::ContextProvider {
LostContextCallback lost_context_callback_;
- bool destroyed_;
-
base::Lock context_lock_;
DISALLOW_COPY_AND_ASSIGN(AwRenderThreadContextProvider);
diff --git a/blimp/client/compositor/blimp_context_provider.cc b/blimp/client/compositor/blimp_context_provider.cc
index 213655e..5e40bbb 100644
--- a/blimp/client/compositor/blimp_context_provider.cc
+++ b/blimp/client/compositor/blimp_context_provider.cc
@@ -150,13 +150,6 @@ void BlimpContextProvider::DeleteCachedResources() {
gr_context_->freeGpuResources();
}
-bool BlimpContextProvider::DestroyedOnMainThread() {
- DCHECK(main_thread_checker_.CalledOnValidThread());
-
- base::AutoLock lock(destroyed_lock_);
- return destroyed_;
-}
-
void BlimpContextProvider::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {
DCHECK(context_thread_checker_.CalledOnValidThread());
@@ -165,14 +158,6 @@ void BlimpContextProvider::SetLostContextCallback(
void BlimpContextProvider::OnLostContext() {
DCHECK(context_thread_checker_.CalledOnValidThread());
-
- {
- base::AutoLock lock(destroyed_lock_);
- if (destroyed_)
- return;
- destroyed_ = true;
- }
-
if (!lost_context_callback_.is_null())
base::ResetAndReturn(&lost_context_callback_).Run();
if (gr_context_)
diff --git a/blimp/client/compositor/blimp_context_provider.h b/blimp/client/compositor/blimp_context_provider.h
index d54d984..b6588b4 100644
--- a/blimp/client/compositor/blimp_context_provider.h
+++ b/blimp/client/compositor/blimp_context_provider.h
@@ -34,7 +34,6 @@ class BlimpContextProvider : public cc::ContextProvider {
base::Lock* GetLock() override;
void VerifyContexts() override;
void DeleteCachedResources() override;
- bool DestroyedOnMainThread() override;
void SetLostContextCallback(
const LostContextCallback& lost_context_callback) override;
@@ -56,9 +55,6 @@ class BlimpContextProvider : public cc::ContextProvider {
LostContextCallback lost_context_callback_;
- base::Lock destroyed_lock_;
- bool destroyed_;
-
DISALLOW_COPY_AND_ASSIGN(BlimpContextProvider);
};
diff --git a/cc/output/context_provider.h b/cc/output/context_provider.h
index ebb98e5..e1a4431 100644
--- a/cc/output/context_provider.h
+++ b/cc/output/context_provider.h
@@ -92,11 +92,6 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> {
// Delete all cached gpu resources.
virtual void DeleteCachedResources() = 0;
- // A method to be called from the main thread that should return true if
- // the context inside the provider is no longer valid.
- // TODO(dcastagna): This is no longer needed and can be removed.
- virtual bool DestroyedOnMainThread() = 0;
-
// Sets a callback to be called when the context is lost. This should be
// called from the same thread that the context is bound to. To avoid races,
// it should be called before BindToCurrentThread(), or VerifyContexts()
diff --git a/cc/raster/tile_task_worker_pool_perftest.cc b/cc/raster/tile_task_worker_pool_perftest.cc
index 7540897..1c4942c 100644
--- a/cc/raster/tile_task_worker_pool_perftest.cc
+++ b/cc/raster/tile_task_worker_pool_perftest.cc
@@ -98,7 +98,6 @@ class PerfContextProvider : public ContextProvider {
base::Lock* GetLock() override { return &context_lock_; }
void VerifyContexts() override {}
void DeleteCachedResources() override {}
- bool DestroyedOnMainThread() override { return false; }
void SetLostContextCallback(const LostContextCallback& cb) override {}
private:
diff --git a/cc/test/test_context_provider.cc b/cc/test/test_context_provider.cc
index c943aad..f702165 100644
--- a/cc/test/test_context_provider.cc
+++ b/cc/test/test_context_provider.cc
@@ -48,7 +48,6 @@ TestContextProvider::TestContextProvider(
: context3d_(context.Pass()),
context_gl_(new TestGLES2Interface(context3d_.get())),
bound_(false),
- destroyed_(false),
weak_ptr_factory_(this) {
DCHECK(main_thread_checker_.CalledOnValidThread());
DCHECK(context3d_);
@@ -69,8 +68,6 @@ bool TestContextProvider::BindToCurrentThread() {
return true;
if (context_gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR) {
- base::AutoLock lock(destroyed_lock_);
- destroyed_ = true;
return false;
}
bound_ = true;
@@ -143,31 +140,13 @@ base::Lock* TestContextProvider::GetLock() {
void TestContextProvider::VerifyContexts() {
DCHECK(bound_);
DCHECK(context_thread_checker_.CalledOnValidThread());
-
- if (ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR) {
- base::AutoLock lock(destroyed_lock_);
- destroyed_ = true;
- }
}
void TestContextProvider::DeleteCachedResources() {
}
-bool TestContextProvider::DestroyedOnMainThread() {
- DCHECK(main_thread_checker_.CalledOnValidThread());
-
- base::AutoLock lock(destroyed_lock_);
- return destroyed_;
-}
-
void TestContextProvider::OnLostContext() {
DCHECK(context_thread_checker_.CalledOnValidThread());
- {
- base::AutoLock lock(destroyed_lock_);
- if (destroyed_)
- return;
- destroyed_ = true;
- }
if (!lost_context_callback_.is_null())
base::ResetAndReturn(&lost_context_callback_).Run();
if (gr_context_)
diff --git a/cc/test/test_context_provider.h b/cc/test/test_context_provider.h
index 994587c..fc98873 100644
--- a/cc/test/test_context_provider.h
+++ b/cc/test/test_context_provider.h
@@ -42,7 +42,6 @@ class TestContextProvider : public ContextProvider {
base::Lock* GetLock() override;
void VerifyContexts() override;
void DeleteCachedResources() override;
- bool DestroyedOnMainThread() override;
void SetLostContextCallback(const LostContextCallback& cb) override;
TestWebGraphicsContext3D* TestContext3d();
@@ -73,9 +72,6 @@ class TestContextProvider : public ContextProvider {
base::ThreadChecker main_thread_checker_;
base::ThreadChecker context_thread_checker_;
- base::Lock destroyed_lock_;
- bool destroyed_;
-
base::Lock context_lock_;
LostContextCallback lost_context_callback_;
diff --git a/cc/test/test_in_process_context_provider.cc b/cc/test/test_in_process_context_provider.cc
index 011a70e..d5b7c28 100644
--- a/cc/test/test_in_process_context_provider.cc
+++ b/cc/test/test_in_process_context_provider.cc
@@ -163,8 +163,6 @@ void TestInProcessContextProvider::DeleteCachedResources() {
gr_context_->freeGpuResources();
}
-bool TestInProcessContextProvider::DestroyedOnMainThread() { return false; }
-
void TestInProcessContextProvider::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {}
diff --git a/cc/test/test_in_process_context_provider.h b/cc/test/test_in_process_context_provider.h
index 79e7cc4..91fe8fd9 100644
--- a/cc/test/test_in_process_context_provider.h
+++ b/cc/test/test_in_process_context_provider.h
@@ -38,7 +38,6 @@ class TestInProcessContextProvider : public ContextProvider {
Capabilities ContextCapabilities() override;
void VerifyContexts() override;
void DeleteCachedResources() override;
- bool DestroyedOnMainThread() override;
void SetLostContextCallback(
const LostContextCallback& lost_context_callback) override;
diff --git a/components/mus/public/cpp/context_provider.h b/components/mus/public/cpp/context_provider.h
index abccb1b..442b6f4 100644
--- a/components/mus/public/cpp/context_provider.h
+++ b/components/mus/public/cpp/context_provider.h
@@ -29,7 +29,6 @@ class ContextProvider : public cc::ContextProvider {
Capabilities ContextCapabilities() override;
void VerifyContexts() override {}
void DeleteCachedResources() override {}
- bool DestroyedOnMainThread() override;
void SetLostContextCallback(
const LostContextCallback& lost_context_callback) override {}
diff --git a/components/mus/public/cpp/lib/context_provider.cc b/components/mus/public/cpp/lib/context_provider.cc
index e56557f..019512e 100644
--- a/components/mus/public/cpp/lib/context_provider.cc
+++ b/components/mus/public/cpp/lib/context_provider.cc
@@ -55,10 +55,6 @@ base::Lock* ContextProvider::GetLock() {
return &context_lock_;
}
-bool ContextProvider::DestroyedOnMainThread() {
- return !context_;
-}
-
ContextProvider::~ContextProvider() {
context_gl_.reset();
if (context_)
diff --git a/components/mus/surfaces/surfaces_context_provider.cc b/components/mus/surfaces/surfaces_context_provider.cc
index b3265c5..49e1436 100644
--- a/components/mus/surfaces/surfaces_context_provider.cc
+++ b/components/mus/surfaces/surfaces_context_provider.cc
@@ -88,10 +88,6 @@ base::Lock* SurfacesContextProvider::GetLock() {
return &context_lock_;
}
-bool SurfacesContextProvider::DestroyedOnMainThread() {
- return !command_buffer_local_;
-}
-
void SurfacesContextProvider::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {
lost_context_callback_ = lost_context_callback;
diff --git a/components/mus/surfaces/surfaces_context_provider.h b/components/mus/surfaces/surfaces_context_provider.h
index a3352d9..19febbb 100644
--- a/components/mus/surfaces/surfaces_context_provider.h
+++ b/components/mus/surfaces/surfaces_context_provider.h
@@ -48,7 +48,6 @@ class SurfacesContextProvider : public cc::ContextProvider,
Capabilities ContextCapabilities() override;
void VerifyContexts() override {}
void DeleteCachedResources() override {}
- bool DestroyedOnMainThread() override;
void SetLostContextCallback(
const LostContextCallback& lost_context_callback) override;
void SetupLock() override;
diff --git a/content/browser/android/in_process/context_provider_in_process.cc b/content/browser/android/in_process/context_provider_in_process.cc
index 3299769..c716879 100644
--- a/content/browser/android/in_process/context_provider_in_process.cc
+++ b/content/browser/android/in_process/context_provider_in_process.cc
@@ -50,7 +50,6 @@ ContextProviderInProcess::ContextProviderInProcess(
scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d,
const std::string& debug_name)
: context3d_(context3d.Pass()),
- destroyed_(false),
debug_name_(debug_name) {
DCHECK(main_thread_checker_.CalledOnValidThread());
DCHECK(context3d_);
@@ -176,25 +175,12 @@ void ContextProviderInProcess::DeleteCachedResources() {
void ContextProviderInProcess::OnLostContext() {
DCHECK(context_thread_checker_.CalledOnValidThread());
- {
- base::AutoLock lock(destroyed_lock_);
- if (destroyed_)
- return;
- destroyed_ = true;
- }
if (!lost_context_callback_.is_null())
base::ResetAndReturn(&lost_context_callback_).Run();
if (gr_context_)
gr_context_->OnLostContext();
}
-bool ContextProviderInProcess::DestroyedOnMainThread() {
- DCHECK(main_thread_checker_.CalledOnValidThread());
-
- base::AutoLock lock(destroyed_lock_);
- return destroyed_;
-}
-
void ContextProviderInProcess::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {
DCHECK(context_thread_checker_.CalledOnValidThread());
diff --git a/content/browser/android/in_process/context_provider_in_process.h b/content/browser/android/in_process/context_provider_in_process.h
index 805fd9e..be22d86 100644
--- a/content/browser/android/in_process/context_provider_in_process.h
+++ b/content/browser/android/in_process/context_provider_in_process.h
@@ -53,7 +53,6 @@ class ContextProviderInProcess
base::Lock* GetLock() override;
void VerifyContexts() override;
void DeleteCachedResources() override;
- bool DestroyedOnMainThread() override;
void SetLostContextCallback(
const LostContextCallback& lost_context_callback) override;
@@ -69,9 +68,6 @@ class ContextProviderInProcess
LostContextCallback lost_context_callback_;
- base::Lock destroyed_lock_;
- bool destroyed_;
-
base::Lock context_lock_;
std::string debug_name_;
class LostContextCallbackProxy;
diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc
index c215dba..d1eb424 100644
--- a/content/common/gpu/client/context_provider_command_buffer.cc
+++ b/content/common/gpu/client/context_provider_command_buffer.cc
@@ -49,8 +49,7 @@ ContextProviderCommandBuffer::ContextProviderCommandBuffer(
CommandBufferContextType type)
: context3d_(context3d.Pass()),
context_type_(type),
- debug_name_(CommandBufferContextTypeToString(type)),
- destroyed_(false) {
+ debug_name_(CommandBufferContextTypeToString(type)) {
DCHECK(main_thread_checker_.CalledOnValidThread());
DCHECK(context3d_);
context_thread_checker_.DetachFromThread();
@@ -60,8 +59,6 @@ ContextProviderCommandBuffer::~ContextProviderCommandBuffer() {
DCHECK(main_thread_checker_.CalledOnValidThread() ||
context_thread_checker_.CalledOnValidThread());
- base::AutoLock lock(main_thread_lock_);
-
// Destroy references to the context3d_ before leaking it.
if (context3d_->GetCommandBufferProxy())
context3d_->GetCommandBufferProxy()->SetLock(nullptr);
@@ -178,12 +175,7 @@ void ContextProviderCommandBuffer::DeleteCachedResources() {
void ContextProviderCommandBuffer::OnLostContext() {
DCHECK(context_thread_checker_.CalledOnValidThread());
- {
- base::AutoLock lock(main_thread_lock_);
- if (destroyed_)
- return;
- destroyed_ = true;
- }
+
if (!lost_context_callback_.is_null())
base::ResetAndReturn(&lost_context_callback_).Run();
if (gr_context_)
@@ -202,13 +194,6 @@ void ContextProviderCommandBuffer::InitializeCapabilities() {
capabilities_ = caps;
}
-bool ContextProviderCommandBuffer::DestroyedOnMainThread() {
- DCHECK(main_thread_checker_.CalledOnValidThread());
-
- base::AutoLock lock(main_thread_lock_);
- return destroyed_;
-}
-
void ContextProviderCommandBuffer::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {
DCHECK(context_thread_checker_.CalledOnValidThread());
diff --git a/content/common/gpu/client/context_provider_command_buffer.h b/content/common/gpu/client/context_provider_command_buffer.h
index b2080b4..13760b8 100644
--- a/content/common/gpu/client/context_provider_command_buffer.h
+++ b/content/common/gpu/client/context_provider_command_buffer.h
@@ -45,7 +45,6 @@ class CONTENT_EXPORT ContextProviderCommandBuffer
Capabilities ContextCapabilities() override;
void VerifyContexts() override;
void DeleteCachedResources() override;
- bool DestroyedOnMainThread() override;
void SetLostContextCallback(
const LostContextCallback& lost_context_callback) override;
@@ -72,9 +71,6 @@ class CONTENT_EXPORT ContextProviderCommandBuffer
LostContextCallback lost_context_callback_;
- base::Lock main_thread_lock_;
- bool destroyed_;
-
base::Lock context_lock_;
class LostContextCallbackProxy;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 4f86bd5..82feaa8 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -1391,7 +1391,8 @@ scoped_refptr<cc_blink::ContextProviderWebContext>
RenderThreadImpl::SharedMainThreadContextProvider() {
DCHECK(IsMainThread());
if (!shared_main_thread_contexts_.get() ||
- shared_main_thread_contexts_->DestroyedOnMainThread()) {
+ shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() !=
+ GL_NO_ERROR) {
shared_main_thread_contexts_ = ContextProviderCommandBuffer::Create(
CreateOffscreenContext3d(), RENDERER_MAINTHREAD_CONTEXT);
if (shared_main_thread_contexts_.get() &&
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc
index 1d96e01..5d08817 100644
--- a/ui/compositor/test/in_process_context_factory.cc
+++ b/ui/compositor/test/in_process_context_factory.cc
@@ -178,8 +178,9 @@ void InProcessContextFactory::RemoveReflector(Reflector* reflector) {
scoped_refptr<cc::ContextProvider>
InProcessContextFactory::SharedMainThreadContextProvider() {
- if (shared_main_thread_contexts_.get() &&
- !shared_main_thread_contexts_->DestroyedOnMainThread())
+ if (shared_main_thread_contexts_ &&
+ shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() ==
+ GL_NO_ERROR)
return shared_main_thread_contexts_;
shared_main_thread_contexts_ = InProcessContextProvider::CreateOffscreen(
diff --git a/ui/compositor/test/in_process_context_provider.cc b/ui/compositor/test/in_process_context_provider.cc
index 92fbf3a..1588da5 100644
--- a/ui/compositor/test/in_process_context_provider.cc
+++ b/ui/compositor/test/in_process_context_provider.cc
@@ -79,8 +79,7 @@ InProcessContextProvider::InProcessContextProvider(
gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
image_factory_(image_factory),
window_(window),
- debug_name_(debug_name),
- destroyed_(false) {
+ debug_name_(debug_name) {
DCHECK(main_thread_checker_.CalledOnValidThread());
context_thread_checker_.DetachFromThread();
}
@@ -200,13 +199,6 @@ void InProcessContextProvider::DeleteCachedResources() {
}
}
-bool InProcessContextProvider::DestroyedOnMainThread() {
- DCHECK(main_thread_checker_.CalledOnValidThread());
-
- base::AutoLock lock(destroyed_lock_);
- return destroyed_;
-}
-
void InProcessContextProvider::SetLostContextCallback(
const LostContextCallback& lost_context_callback) {
lost_context_callback_ = lost_context_callback;
@@ -214,12 +206,6 @@ void InProcessContextProvider::SetLostContextCallback(
void InProcessContextProvider::OnLostContext() {
DCHECK(context_thread_checker_.CalledOnValidThread());
- {
- base::AutoLock lock(destroyed_lock_);
- if (destroyed_)
- return;
- destroyed_ = true;
- }
if (!lost_context_callback_.is_null())
base::ResetAndReturn(&lost_context_callback_).Run();
if (gr_context_)
diff --git a/ui/compositor/test/in_process_context_provider.h b/ui/compositor/test/in_process_context_provider.h
index b728041..c80fb0f 100644
--- a/ui/compositor/test/in_process_context_provider.h
+++ b/ui/compositor/test/in_process_context_provider.h
@@ -50,7 +50,6 @@ class InProcessContextProvider : public cc::ContextProvider {
base::Lock* GetLock() override;
void VerifyContexts() override;
void DeleteCachedResources() override;
- bool DestroyedOnMainThread() override;
void SetLostContextCallback(
const LostContextCallback& lost_context_callback) override;
@@ -80,9 +79,6 @@ class InProcessContextProvider : public cc::ContextProvider {
LostContextCallback lost_context_callback_;
- base::Lock destroyed_lock_;
- bool destroyed_;
-
base::Lock context_lock_;
DISALLOW_COPY_AND_ASSIGN(InProcessContextProvider);