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

Side by Side Diff: ppapi/shared_impl/ppb_video_decoder_shared.cc

Issue 8790004: Rename the shared impl files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/shared_impl/ppb_video_decoder_shared.h ('k') | ppapi/shared_impl/url_request_info_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "ppapi/shared_impl/video_decoder_impl.h" 5 #include "ppapi/shared_impl/ppb_video_decoder_shared.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "gpu/command_buffer/client/gles2_implementation.h" 8 #include "gpu/command_buffer/client/gles2_implementation.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/shared_impl/resource_tracker.h" 10 #include "ppapi/shared_impl/resource_tracker.h"
11 #include "ppapi/thunk/enter.h" 11 #include "ppapi/thunk/enter.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14 14
15 VideoDecoderImpl::VideoDecoderImpl() 15 PPB_VideoDecoder_Shared::PPB_VideoDecoder_Shared()
16 : flush_callback_(PP_MakeCompletionCallback(NULL, NULL)), 16 : flush_callback_(PP_MakeCompletionCallback(NULL, NULL)),
17 reset_callback_(PP_MakeCompletionCallback(NULL, NULL)), 17 reset_callback_(PP_MakeCompletionCallback(NULL, NULL)),
18 graphics_context_(0), 18 graphics_context_(0),
19 gles2_impl_(NULL) { 19 gles2_impl_(NULL) {
20 } 20 }
21 21
22 VideoDecoderImpl::~VideoDecoderImpl() { 22 PPB_VideoDecoder_Shared::~PPB_VideoDecoder_Shared() {
23 } 23 }
24 24
25 void VideoDecoderImpl::InitCommon( 25 void PPB_VideoDecoder_Shared::InitCommon(
26 PP_Resource graphics_context, 26 PP_Resource graphics_context,
27 gpu::gles2::GLES2Implementation* gles2_impl) { 27 gpu::gles2::GLES2Implementation* gles2_impl) {
28 DCHECK(graphics_context); 28 DCHECK(graphics_context);
29 DCHECK(!gles2_impl_ && !graphics_context_); 29 DCHECK(!gles2_impl_ && !graphics_context_);
30 gles2_impl_ = gles2_impl; 30 gles2_impl_ = gles2_impl;
31 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(graphics_context); 31 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(graphics_context);
32 graphics_context_ = graphics_context; 32 graphics_context_ = graphics_context;
33 } 33 }
34 34
35 void VideoDecoderImpl::Destroy() { 35 void PPB_VideoDecoder_Shared::Destroy() {
36 graphics_context_ = 0; 36 graphics_context_ = 0;
37 gles2_impl_ = NULL; 37 gles2_impl_ = NULL;
38 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(graphics_context_); 38 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(graphics_context_);
39 } 39 }
40 40
41 bool VideoDecoderImpl::SetFlushCallback(PP_CompletionCallback callback) { 41 bool PPB_VideoDecoder_Shared::SetFlushCallback(PP_CompletionCallback callback) {
42 CHECK(callback.func); 42 CHECK(callback.func);
43 if (flush_callback_.func) 43 if (flush_callback_.func)
44 return false; 44 return false;
45 flush_callback_ = callback; 45 flush_callback_ = callback;
46 return true; 46 return true;
47 } 47 }
48 48
49 bool VideoDecoderImpl::SetResetCallback(PP_CompletionCallback callback) { 49 bool PPB_VideoDecoder_Shared::SetResetCallback(PP_CompletionCallback callback) {
50 CHECK(callback.func); 50 CHECK(callback.func);
51 if (reset_callback_.func) 51 if (reset_callback_.func)
52 return false; 52 return false;
53 reset_callback_ = callback; 53 reset_callback_ = callback;
54 return true; 54 return true;
55 } 55 }
56 56
57 bool VideoDecoderImpl::SetBitstreamBufferCallback( 57 bool PPB_VideoDecoder_Shared::SetBitstreamBufferCallback(
58 int32 bitstream_buffer_id, PP_CompletionCallback callback) { 58 int32 bitstream_buffer_id, PP_CompletionCallback callback) {
59 return bitstream_buffer_callbacks_.insert( 59 return bitstream_buffer_callbacks_.insert(
60 std::make_pair(bitstream_buffer_id, callback)).second; 60 std::make_pair(bitstream_buffer_id, callback)).second;
61 } 61 }
62 62
63 void VideoDecoderImpl::RunFlushCallback(int32 result) { 63 void PPB_VideoDecoder_Shared::RunFlushCallback(int32 result) {
64 DCHECK(flush_callback_.func); 64 DCHECK(flush_callback_.func);
65 PP_RunAndClearCompletionCallback(&flush_callback_, result); 65 PP_RunAndClearCompletionCallback(&flush_callback_, result);
66 } 66 }
67 67
68 void VideoDecoderImpl::RunResetCallback(int32 result) { 68 void PPB_VideoDecoder_Shared::RunResetCallback(int32 result) {
69 DCHECK(reset_callback_.func); 69 DCHECK(reset_callback_.func);
70 PP_RunAndClearCompletionCallback(&reset_callback_, result); 70 PP_RunAndClearCompletionCallback(&reset_callback_, result);
71 } 71 }
72 72
73 void VideoDecoderImpl::RunBitstreamBufferCallback( 73 void PPB_VideoDecoder_Shared::RunBitstreamBufferCallback(
74 int32 bitstream_buffer_id, int32 result) { 74 int32 bitstream_buffer_id, int32 result) {
75 CallbackById::iterator it = 75 CallbackById::iterator it =
76 bitstream_buffer_callbacks_.find(bitstream_buffer_id); 76 bitstream_buffer_callbacks_.find(bitstream_buffer_id);
77 DCHECK(it != bitstream_buffer_callbacks_.end()); 77 DCHECK(it != bitstream_buffer_callbacks_.end());
78 PP_CompletionCallback cc = it->second; 78 PP_CompletionCallback cc = it->second;
79 bitstream_buffer_callbacks_.erase(it); 79 bitstream_buffer_callbacks_.erase(it);
80 PP_RunCompletionCallback(&cc, PP_OK); 80 PP_RunCompletionCallback(&cc, PP_OK);
81 } 81 }
82 82
83 void VideoDecoderImpl::FlushCommandBuffer() { 83 void PPB_VideoDecoder_Shared::FlushCommandBuffer() {
84 if (gles2_impl_) 84 if (gles2_impl_)
85 gles2_impl_->Flush(); 85 gles2_impl_->Flush();
86 } 86 }
87 87
88 } // namespace ppapi 88 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_video_decoder_shared.h ('k') | ppapi/shared_impl/url_request_info_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698