| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace content { | 21 namespace content { |
| 22 | 22 |
| 23 class RendererPpapiHost; | 23 class RendererPpapiHost; |
| 24 | 24 |
| 25 class CONTENT_EXPORT PepperVideoSourceHost : public ppapi::host::ResourceHost { | 25 class CONTENT_EXPORT PepperVideoSourceHost : public ppapi::host::ResourceHost { |
| 26 public: | 26 public: |
| 27 PepperVideoSourceHost(RendererPpapiHost* host, | 27 PepperVideoSourceHost(RendererPpapiHost* host, |
| 28 PP_Instance instance, | 28 PP_Instance instance, |
| 29 PP_Resource resource); | 29 PP_Resource resource); |
| 30 | 30 |
| 31 virtual ~PepperVideoSourceHost(); | 31 ~PepperVideoSourceHost() override; |
| 32 | 32 |
| 33 virtual int32_t OnResourceMessageReceived( | 33 int32_t OnResourceMessageReceived( |
| 34 const IPC::Message& msg, | 34 const IPC::Message& msg, |
| 35 ppapi::host::HostMessageContext* context) override; | 35 ppapi::host::HostMessageContext* context) override; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 // This helper object receives frames on a video worker thread and passes | 38 // This helper object receives frames on a video worker thread and passes |
| 39 // them on to us. | 39 // them on to us. |
| 40 class FrameReceiver : public FrameReaderInterface, | 40 class FrameReceiver : public FrameReaderInterface, |
| 41 public base::RefCountedThreadSafe<FrameReceiver> { | 41 public base::RefCountedThreadSafe<FrameReceiver> { |
| 42 public: | 42 public: |
| 43 explicit FrameReceiver(const base::WeakPtr<PepperVideoSourceHost>& host); | 43 explicit FrameReceiver(const base::WeakPtr<PepperVideoSourceHost>& host); |
| 44 | 44 |
| 45 // FrameReaderInterface implementation. | 45 // FrameReaderInterface implementation. |
| 46 virtual void GotFrame(const scoped_refptr<media::VideoFrame>& frame) | 46 void GotFrame(const scoped_refptr<media::VideoFrame>& frame) override; |
| 47 override; | |
| 48 | 47 |
| 49 private: | 48 private: |
| 50 friend class base::RefCountedThreadSafe<FrameReceiver>; | 49 friend class base::RefCountedThreadSafe<FrameReceiver>; |
| 51 virtual ~FrameReceiver(); | 50 ~FrameReceiver() override; |
| 52 | 51 |
| 53 base::WeakPtr<PepperVideoSourceHost> host_; | 52 base::WeakPtr<PepperVideoSourceHost> host_; |
| 54 // |thread_checker_| is bound to the main render thread. | 53 // |thread_checker_| is bound to the main render thread. |
| 55 base::ThreadChecker thread_checker_; | 54 base::ThreadChecker thread_checker_; |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 friend class FrameReceiver; | 57 friend class FrameReceiver; |
| 59 | 58 |
| 60 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, | 59 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, |
| 61 const std::string& stream_url); | 60 const std::string& stream_url); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 81 bool get_frame_pending_; | 80 bool get_frame_pending_; |
| 82 | 81 |
| 83 base::WeakPtrFactory<PepperVideoSourceHost> weak_factory_; | 82 base::WeakPtrFactory<PepperVideoSourceHost> weak_factory_; |
| 84 | 83 |
| 85 DISALLOW_COPY_AND_ASSIGN(PepperVideoSourceHost); | 84 DISALLOW_COPY_AND_ASSIGN(PepperVideoSourceHost); |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 } // namespace content | 87 } // namespace content |
| 89 | 88 |
| 90 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ | 89 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ |
| OLD | NEW |