Disable view source for Developer Tools.
[chromium-blink-merge.git] / ppapi / proxy / media_stream_track_resource_base.h
blob4a4aa3b7572cec3269c53ccaadbbb546c15de307
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_
6 #define PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_
8 #include "ppapi/proxy/plugin_resource.h"
9 #include "ppapi/proxy/ppapi_proxy_export.h"
10 #include "ppapi/shared_impl/media_stream_frame_buffer.h"
12 namespace ppapi {
13 namespace proxy {
15 class PPAPI_PROXY_EXPORT MediaStreamTrackResourceBase
16 : public PluginResource,
17 public MediaStreamFrameBuffer::Delegate {
18 protected:
19 MediaStreamTrackResourceBase(Connection connection,
20 PP_Instance instance,
21 int pending_renderer_id,
22 const std::string& id);
24 virtual ~MediaStreamTrackResourceBase();
26 std::string id() const { return id_; }
28 bool has_ended() const { return has_ended_; }
30 MediaStreamFrameBuffer* frame_buffer() { return &frame_buffer_; }
32 void CloseInternal();
34 // Sends a frame index to the corresponding PepperMediaStreamTrackHostBase
35 // via an IPC message. The host adds the frame index into its
36 // |frame_buffer_| for reading or writing. Also see |MediaStreamFrameBuffer|.
37 void SendEnqueueFrameMessageToHost(int32_t index);
39 // PluginResource overrides:
40 virtual void OnReplyReceived(const ResourceMessageReplyParams& params,
41 const IPC::Message& msg) OVERRIDE;
43 private:
44 // Message handlers:
45 void OnPluginMsgInitFrames(const ResourceMessageReplyParams& params,
46 int32_t number_of_frames,
47 int32_t frame_size);
48 void OnPluginMsgEnqueueFrame(const ResourceMessageReplyParams& params,
49 int32_t index);
51 MediaStreamFrameBuffer frame_buffer_;
53 std::string id_;
55 bool has_ended_;
57 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrackResourceBase);
60 } // namespace proxy
61 } // namespace ppapi
63 #endif // PPAPI_PROXY_MEDIA_STREAM_TRACK_RESOURCE_BASE_H_