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

Side by Side Diff: webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc

Issue 1909593002: Cleanup webrtc/modules/desktop_capture (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 18 matching lines...) Expand all
29 namespace webrtc { 29 namespace webrtc {
30 30
31 namespace { 31 namespace {
32 32
33 // Constants from dwmapi.h. 33 // Constants from dwmapi.h.
34 const UINT DWM_EC_DISABLECOMPOSITION = 0; 34 const UINT DWM_EC_DISABLECOMPOSITION = 0;
35 const UINT DWM_EC_ENABLECOMPOSITION = 1; 35 const UINT DWM_EC_ENABLECOMPOSITION = 1;
36 36
37 const wchar_t kDwmapiLibraryName[] = L"dwmapi.dll"; 37 const wchar_t kDwmapiLibraryName[] = L"dwmapi.dll";
38 38
39 // SharedMemoryFactory that creates SharedMemory using the deprecated
40 // DesktopCapturer::Callback::CreateSharedMemory().
41 class CallbackSharedMemoryFactory : public SharedMemoryFactory {
42 public:
43 CallbackSharedMemoryFactory(DesktopCapturer::Callback* callback)
44 : callback_(callback) {}
45 ~CallbackSharedMemoryFactory() override {}
46
47 rtc::scoped_ptr<SharedMemory> CreateSharedMemory(size_t size) override {
48 return rtc::scoped_ptr<SharedMemory>(callback_->CreateSharedMemory(size));
49 }
50
51 private:
52 DesktopCapturer::Callback* callback_;
53 };
54
55 } // namespace 39 } // namespace
56 40
57 ScreenCapturerWinGdi::ScreenCapturerWinGdi(const DesktopCaptureOptions& options) 41 ScreenCapturerWinGdi::ScreenCapturerWinGdi(const DesktopCaptureOptions& options)
58 : callback_(NULL), 42 : callback_(NULL),
59 current_screen_id_(kFullDesktopScreenId), 43 current_screen_id_(kFullDesktopScreenId),
60 desktop_dc_(NULL), 44 desktop_dc_(NULL),
61 memory_dc_(NULL), 45 memory_dc_(NULL),
62 dwmapi_library_(NULL), 46 dwmapi_library_(NULL),
63 composition_func_(NULL), 47 composition_func_(NULL),
64 set_thread_execution_state_failed_(false) { 48 set_thread_execution_state_failed_(false) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (valid) 149 if (valid)
166 current_screen_id_ = id; 150 current_screen_id_ = id;
167 return valid; 151 return valid;
168 } 152 }
169 153
170 void ScreenCapturerWinGdi::Start(Callback* callback) { 154 void ScreenCapturerWinGdi::Start(Callback* callback) {
171 assert(!callback_); 155 assert(!callback_);
172 assert(callback); 156 assert(callback);
173 157
174 callback_ = callback; 158 callback_ = callback;
175 if (!shared_memory_factory_)
176 shared_memory_factory_.reset(new CallbackSharedMemoryFactory(callback));
177 159
178 // Vote to disable Aero composited desktop effects while capturing. Windows 160 // Vote to disable Aero composited desktop effects while capturing. Windows
179 // will restore Aero automatically if the process exits. This has no effect 161 // will restore Aero automatically if the process exits. This has no effect
180 // under Windows 8 or higher. See crbug.com/124018. 162 // under Windows 8 or higher. See crbug.com/124018.
181 if (composition_func_) 163 if (composition_func_)
182 (*composition_func_)(DWM_EC_DISABLECOMPOSITION); 164 (*composition_func_)(DWM_EC_DISABLECOMPOSITION);
183 } 165 }
184 166
185 void ScreenCapturerWinGdi::PrepareCaptureResources() { 167 void ScreenCapturerWinGdi::PrepareCaptureResources() {
186 // Switch to the desktop receiving user input if different from the current 168 // Switch to the desktop receiving user input if different from the current
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 SRCCOPY | CAPTUREBLT); 265 SRCCOPY | CAPTUREBLT);
284 266
285 // Select back the previously selected object to that the device contect 267 // Select back the previously selected object to that the device contect
286 // could be destroyed independently of the bitmap if needed. 268 // could be destroyed independently of the bitmap if needed.
287 SelectObject(memory_dc_, previous_object); 269 SelectObject(memory_dc_, previous_object);
288 } 270 }
289 return true; 271 return true;
290 } 272 }
291 273
292 } // namespace webrtc 274 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc ('k') | webrtc/modules/desktop_capture/window_capturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698