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

Side by Side Diff: webrtc/modules/desktop_capture/shared_memory.h

Issue 1678073003: Cleanup shared memory handling in DesktopCapturer interface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SHARED_MEMORY_H_ 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SHARED_MEMORY_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_SHARED_MEMORY_H_ 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_SHARED_MEMORY_H_
13 13
14 #include <stddef.h> 14 #include <stddef.h>
15 15
16 #if defined(WEBRTC_WIN) 16 #if defined(WEBRTC_WIN)
17 #include <windows.h> 17 #include <windows.h>
18 #endif 18 #endif
19 19
20 #include "webrtc/base/scoped_ptr.h"
20 #include "webrtc/base/constructormagic.h" 21 #include "webrtc/base/constructormagic.h"
21 #include "webrtc/typedefs.h" 22 #include "webrtc/typedefs.h"
22 23
23 namespace webrtc { 24 namespace webrtc {
24 25
25 // SharedMemory is a base class for shared memory. It stores all required 26 // SharedMemory is a base class for shared memory. It stores all required
26 // parameters of the buffer, but doesn't have any logic to allocate or destroy 27 // parameters of the buffer, but doesn't have any logic to allocate or destroy
27 // the actual buffer. DesktopCapturer consumers that need to use shared memory 28 // the actual buffer. DesktopCapturer consumers that need to use shared memory
28 // for video frames must extend this class with creation and destruction logic 29 // for video frames must extend this class with creation and destruction logic
29 // specific for the target platform and then implement 30 // specific for the target platform and then call
30 // DesktopCapturer::Delegate::CreateSharedMemory() as appropriate. 31 // DesktopCapturer::SetSharedMemoryFactory().
31 class SharedMemory { 32 class SharedMemory {
32 public: 33 public:
33 #if defined(WEBRTC_WIN) 34 #if defined(WEBRTC_WIN)
34 typedef HANDLE Handle; 35 typedef HANDLE Handle;
35 static const Handle kInvalidHandle; 36 static const Handle kInvalidHandle;
36 #else 37 #else
37 typedef int Handle; 38 typedef int Handle;
38 static const Handle kInvalidHandle; 39 static const Handle kInvalidHandle;
39 #endif 40 #endif
40 41
(...skipping 14 matching lines...) Expand all
55 56
56 void* const data_; 57 void* const data_;
57 const size_t size_; 58 const size_t size_;
58 const Handle handle_; 59 const Handle handle_;
59 const int id_; 60 const int id_;
60 61
61 private: 62 private:
62 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemory); 63 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemory);
63 }; 64 };
64 65
66 // Interface used to create SharedMemory instances.
67 class SharedMemoryFactory {
68 public:
69 SharedMemoryFactory() {}
70 virtual ~SharedMemoryFactory() {}
71
72 virtual rtc::scoped_ptr<SharedMemory> CreateSharedMemory(size_t size) = 0;
73
74 private:
75 RTC_DISALLOW_COPY_AND_ASSIGN(SharedMemoryFactory);
76 };
77
65 } // namespace webrtc 78 } // namespace webrtc
66 79
67 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SHARED_MEMORY_H_ 80 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SHARED_MEMORY_H_
68 81
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698