Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "webrtc/modules/desktop_capture/shared_memory.h" | 11 #include "webrtc/modules/desktop_capture/shared_memory.h" |
| 12 | 12 |
| 13 #include "webrtc/base/checks.h" | |
| 14 | |
| 13 namespace webrtc { | 15 namespace webrtc { |
| 14 | 16 |
| 15 #if defined(WEBRTC_WIN) | 17 #if defined(WEBRTC_WIN) |
| 16 const SharedMemory::Handle SharedMemory::kInvalidHandle = NULL; | 18 const SharedMemory::Handle SharedMemory::kInvalidHandle = NULL; |
| 17 #else | 19 #else |
| 18 const SharedMemory::Handle SharedMemory::kInvalidHandle = -1; | 20 const SharedMemory::Handle SharedMemory::kInvalidHandle = -1; |
| 19 #endif | 21 #endif |
| 20 | 22 |
| 21 SharedMemory::SharedMemory(void* data, size_t size, Handle handle, int id) | 23 SharedMemory::SharedMemory(void* data, size_t size, Handle handle, int id) |
| 22 : data_(data), | 24 : data_(data), |
| 23 size_(size), | 25 size_(size), |
| 24 handle_(handle), | 26 handle_(handle), |
| 25 id_(id) { | 27 id_(id) { |
| 26 } | 28 } |
| 27 | 29 |
| 30 SharedMemoryFactoryWrapper::SharedMemoryFactoryWrapper( | |
| 31 SharedMemoryFactory* factory) { | |
| 32 RTC_DCHECK(factory); | |
| 33 factory_ = factory; | |
| 34 } | |
| 35 | |
| 36 SharedMemoryFactoryWrapper::~SharedMemoryFactoryWrapper() = default; | |
| 37 | |
| 38 //static | |
| 39 std::unique_ptr<SharedMemoryFactory> SharedMemoryFactoryWrapper::Wrap( | |
| 40 const std::unique_ptr<SharedMemoryFactory>& factory) { | |
| 41 return std::unique_ptr<SharedMemoryFactory>(new SharedMemoryFactoryWrapper( | |
| 42 factory.get())); | |
|
Jamie
2017/02/15 18:43:49
I don't think this is an acceptable use of unique_
Hzj_jie
2017/02/15 21:20:36
This class is used in FallbackDesktopCapturerWrapp
| |
| 43 } | |
| 44 | |
| 45 std::unique_ptr<SharedMemory> SharedMemoryFactoryWrapper::CreateSharedMemory( | |
| 46 size_t size) { | |
| 47 return factory_->CreateSharedMemory(size); | |
| 48 } | |
| 49 | |
| 28 } // namespace webrtc | 50 } // namespace webrtc |
| OLD | NEW |