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

Unified Diff: content/gpu/gpu_main.cc

Issue 23992006: Warm up DWM prior to lowering token. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/gpu_main.cc
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index eeaa11b08c1cac214c37a6cb7c5a6bd02f216a54..da063d84ed3b0db038cc0616beaaab41eb6c4d0d 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -5,6 +5,7 @@
#include <stdlib.h>
#if defined(OS_WIN)
+#include <dwmapi.h>
#include <windows.h>
#endif
@@ -35,6 +36,7 @@
#include "ui/gl/gpu_switching_manager.h"
#if defined(OS_WIN)
+#include "base/win/windows_version.h"
#include "base/win/scoped_com_initializer.h"
#include "content/common/gpu/media/dxva_video_decode_accelerator.h"
#include "sandbox/win/src/sandbox.h"
@@ -375,6 +377,25 @@ bool WarmUpSandbox(const CommandLine& command_line) {
// Initialize H/W video decoding stuff which fails in the sandbox.
DXVAVideoDecodeAccelerator::PreSandboxInitialization();
}
+
+ {
+ TRACE_EVENT0("gpu", "Warm up DWM");
+
+ // DWM was introduced with Windows Vista. DwmFlush seems to be sufficient
+ // to warm it up before lowering the token. DWM is required to present to
+ // a window with Vista and later and this allows us to do so with the
+ // GPU process sandbox enabled.
+ if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
+ HMODULE module = LoadLibrary(L"dwmapi.dll");
+ if (module) {
+ typedef HRESULT (WINAPI *DwmFlushFunc)();
+ DwmFlushFunc dwm_flush = reinterpret_cast<DwmFlushFunc>(
+ GetProcAddress(module, "DwmFlush"));
+ if (dwm_flush)
+ dwm_flush();
+ }
+ }
+ }
#endif
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698