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

Unified Diff: media/video/capture/screen/screen_capturer_win.cc

Issue 13556004: Add CreateWithDisableAero, to allow Windows capturer to be created without disabling Aero. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove comment. Created 7 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
« no previous file with comments | « media/video/capture/screen/screen_capturer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/screen/screen_capturer_win.cc
diff --git a/media/video/capture/screen/screen_capturer_win.cc b/media/video/capture/screen/screen_capturer_win.cc
index aa844d9c9023255c807da3519c8af5b320d1abaa..ab78aa5b04035f3f76c09a2d32e4c815940a781c 100644
--- a/media/video/capture/screen/screen_capturer_win.cc
+++ b/media/video/capture/screen/screen_capturer_win.cc
@@ -75,7 +75,7 @@ class ScreenCaptureFrameWin : public ScreenCaptureFrame {
// ScreenCapturerWin is double-buffered as required by ScreenCapturer.
class ScreenCapturerWin : public ScreenCapturer {
public:
- ScreenCapturerWin();
+ ScreenCapturerWin(bool disable_aero);
virtual ~ScreenCapturerWin();
// Overridden from ScreenCapturer:
@@ -203,11 +203,24 @@ void ScreenCaptureFrameWin::AllocateBitmap(HDC desktop_dc,
bmi.bmiHeader.biSizeImage / std::abs(bmi.bmiHeader.biHeight));
}
-ScreenCapturerWin::ScreenCapturerWin()
+ScreenCapturerWin::ScreenCapturerWin(bool disable_aero)
: delegate_(NULL),
desktop_dc_rect_(SkIRect::MakeEmpty()),
composition_func_(NULL),
set_thread_execution_state_failed_(false) {
+ if (disable_aero) {
+ // Load dwmapi.dll dynamically since it is not available on XP.
+ if (!dwmapi_library_.is_valid()) {
+ base::FilePath path(base::GetNativeLibraryName(
+ UTF8ToUTF16(kDwmapiLibraryName)));
+ dwmapi_library_.Reset(base::LoadNativeLibrary(path, NULL));
+ }
+
+ if (dwmapi_library_.is_valid() && composition_func_ == NULL) {
+ composition_func_ = static_cast<DwmEnableCompositionFunc>(
+ dwmapi_library_.GetFunctionPointer("DwmEnableComposition"));
+ }
+ }
}
ScreenCapturerWin::~ScreenCapturerWin() {
@@ -275,18 +288,6 @@ void ScreenCapturerWin::Start(Delegate* delegate) {
delegate_ = delegate;
- // Load dwmapi.dll dynamically since it is not available on XP.
- if (!dwmapi_library_.is_valid()) {
- base::FilePath path(base::GetNativeLibraryName(
- UTF8ToUTF16(kDwmapiLibraryName)));
- dwmapi_library_.Reset(base::LoadNativeLibrary(path, NULL));
- }
-
- if (dwmapi_library_.is_valid() && composition_func_ == NULL) {
- composition_func_ = static_cast<DwmEnableCompositionFunc>(
- dwmapi_library_.GetFunctionPointer("DwmEnableComposition"));
- }
-
// Vote to disable Aero composited desktop effects while capturing. Windows
// will restore Aero automatically if the process exits. This has no effect
// under Windows 8 or higher. See crbug.com/124018.
@@ -602,7 +603,13 @@ void ScreenCapturer::Delegate::ReleaseSharedBuffer(
// static
scoped_ptr<ScreenCapturer> ScreenCapturer::Create() {
- return scoped_ptr<ScreenCapturer>(new ScreenCapturerWin());
+ return CreateWithDisableAero(true);
+}
+
+// static
+scoped_ptr<ScreenCapturer> ScreenCapturer::CreateWithDisableAero(
+ bool disable_aero) {
+ return scoped_ptr<ScreenCapturer>(new ScreenCapturerWin(disable_aero));
}
} // namespace media
« no previous file with comments | « media/video/capture/screen/screen_capturer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698