Chromium Code Reviews| Index: media/video/capture/screen/shared_desktop_frame.h |
| diff --git a/media/video/capture/screen/shared_desktop_frame.h b/media/video/capture/screen/shared_desktop_frame.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0ee75b16dcc4bdeae6d0a2d9023c2ce26b7ab6fa |
| --- /dev/null |
| +++ b/media/video/capture/screen/shared_desktop_frame.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_VIDEO_CAPTURE_SCREEN_SHARED_DESKTOP_FRAME_H_ |
| +#define MEDIA_VIDEO_CAPTURE_SCREEN_SHARED_DESKTOP_FRAME_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
| + |
| +namespace media { |
| + |
| +// SharedDesktopFrame is a DesktopFrame that may have multiple instances all |
| +// sharing the same buffer. |
| +class SharedDesktopFrame : public webrtc::DesktopFrame { |
| + public: |
| + virtual ~SharedDesktopFrame(); |
| + |
| + static SharedDesktopFrame* Wrap(webrtc::DesktopFrame* desktop_frame); |
| + |
| + // Returns underlying instance of DesktopFrame. |
|
alexeypa (please no reviews)
2013/05/13 17:02:00
nit: Returns the underlying instance...
Sergey Ulanov
2013/05/13 21:16:52
Done.
|
| + webrtc::DesktopFrame* GetUnderlyingFrame(); |
| + |
| + // Creates a clone of this object. |
| + SharedDesktopFrame* Share(); |
|
alexeypa (please no reviews)
2013/05/13 17:02:00
nit: Share() -> Clone()?
Sergey Ulanov
2013/05/13 21:16:52
I think it's better to call it Share() because the
|
| + |
| + // Checks if the frame is currently shared or not. If it returns true it's |
| + // guaranteed that there are no clones of the object. |
| + bool IsNotShared(); |
|
alexeypa (please no reviews)
2013/05/13 17:02:00
nit: IsShared() is shorter and can always be negat
Sergey Ulanov
2013/05/13 21:16:52
Done.
|
| + |
| + private: |
| + class Core; |
| + |
| + SharedDesktopFrame(scoped_refptr<Core> core); |
| + |
| + scoped_refptr<Core> core_; |
|
alexeypa (please no reviews)
2013/05/13 17:02:00
nit: You don't really need a full blown Core class
Sergey Ulanov
2013/05/13 21:16:52
I'm not sure how that would work - scoped_ptr<> do
alexeypa (please no reviews)
2013/05/13 22:37:37
Yes, you are right. That totally wouldn't work. :(
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(SharedDesktopFrame); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_VIDEO_CAPTURE_SCREEN_SHARED_DESKTOP_FRAME_H_ |