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

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: Remove prototype 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..09dab3bf07a5c7121a13abff21f06cd6881fabf3 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/public/browser/gpu_data_manager.h"
Zhenyao Mo 2014/04/09 22:24:24 Usually inside content side, we directly use gpu_d
ccameron 2014/04/09 22:37:28 Done.
#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));
+
+ content::GpuDataManager::GetInstance()->AddObserver(this);
Zhenyao Mo 2014/04/09 22:24:24 nit:no need for content namespace, and use GpuData
ccameron 2014/04/09 22:37:28 Done.
}
CompositingIOSurfaceContext::~CompositingIOSurfaceContext() {
+ content::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