Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1076)

Unified Diff: content/browser/renderer_host/compositing_iosurface_context_mac.mm

Issue 231863002: Mac: Recreate browser-side GL contexts on GPU switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/compositing_iosurface_context_mac.mm
diff --git a/content/browser/renderer_host/compositing_iosurface_context_mac.mm b/content/browser/renderer_host/compositing_iosurface_context_mac.mm
index 95620367b0e3c74bf442be7eae6e0f51eb924050..fecab509325fd0c1f8d6cd3cb840afdf488ae973 100644
--- a/content/browser/renderer_host/compositing_iosurface_context_mac.mm
+++ b/content/browser/renderer_host/compositing_iosurface_context_mac.mm
@@ -12,6 +12,7 @@
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "content/browser/renderer_host/compositing_iosurface_shader_programs_mac.h"
+#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "ui/base/ui_base_switches.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/gpu_switching_manager.h"
@@ -182,9 +183,13 @@ CompositingIOSurfaceContext::CompositingIOSurfaceContext(
poisoned_(false) {
DCHECK(window_map()->find(window_number_) == window_map()->end());
window_map()->insert(std::make_pair(window_number_, this));
+
+ GpuDataManager::GetInstance()->AddObserver(this);
}
CompositingIOSurfaceContext::~CompositingIOSurfaceContext() {
+ GpuDataManager::GetInstance()->RemoveObserver(this);
+
{
gfx::ScopedCGLSetCurrentContext scoped_set_current_context(cgl_context_);
shader_program_cache_->Reset();
@@ -206,6 +211,13 @@ NSOpenGLContext* CompositingIOSurfaceContext::nsgl_context() const {
return nsgl_context_;
}
+void CompositingIOSurfaceContext::OnGpuSwitching() {
+ // Recreate all browser-side GL contexts whenever the GPU switches. If this
+ // is not done, performance will suffer.
+ // http://crbug.com/361493
+ PoisonContextAndSharegroup();
+}
+
// static
CompositingIOSurfaceContext::WindowMap*
CompositingIOSurfaceContext::window_map() {

Powered by Google App Engine
This is Rietveld 408576698