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

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

Issue 8824015: Revert 113290 - Rename the shared_impl resource files to give them more regular names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/shared_impl/ppb_video_decoder_shared.h"
6
7 #include "base/logging.h"
8 #include "gpu/command_buffer/client/gles2_implementation.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/shared_impl/resource_tracker.h"
11 #include "ppapi/thunk/enter.h"
12
13 namespace ppapi {
14
15 PPB_VideoDecoder_Shared::PPB_VideoDecoder_Shared()
16 : flush_callback_(PP_MakeCompletionCallback(NULL, NULL)),
17 reset_callback_(PP_MakeCompletionCallback(NULL, NULL)),
18 graphics_context_(0),
19 gles2_impl_(NULL) {
20 }
21
22 PPB_VideoDecoder_Shared::~PPB_VideoDecoder_Shared() {
23 }
24
25 void PPB_VideoDecoder_Shared::InitCommon(
26 PP_Resource graphics_context,
27 gpu::gles2::GLES2Implementation* gles2_impl) {
28 DCHECK(graphics_context);
29 DCHECK(!gles2_impl_ && !graphics_context_);
30 gles2_impl_ = gles2_impl;
31 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(graphics_context);
32 graphics_context_ = graphics_context;
33 }
34
35 void PPB_VideoDecoder_Shared::Destroy() {
36 graphics_context_ = 0;
37 gles2_impl_ = NULL;
38 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(graphics_context_);
39 }
40
41 bool PPB_VideoDecoder_Shared::SetFlushCallback(PP_CompletionCallback callback) {
42 CHECK(callback.func);
43 if (flush_callback_.func)
44 return false;
45 flush_callback_ = callback;
46 return true;
47 }
48
49 bool PPB_VideoDecoder_Shared::SetResetCallback(PP_CompletionCallback callback) {
50 CHECK(callback.func);
51 if (reset_callback_.func)
52 return false;
53 reset_callback_ = callback;
54 return true;
55 }
56
57 bool PPB_VideoDecoder_Shared::SetBitstreamBufferCallback(
58 int32 bitstream_buffer_id, PP_CompletionCallback callback) {
59 return bitstream_buffer_callbacks_.insert(
60 std::make_pair(bitstream_buffer_id, callback)).second;
61 }
62
63 void PPB_VideoDecoder_Shared::RunFlushCallback(int32 result) {
64 DCHECK(flush_callback_.func);
65 PP_RunAndClearCompletionCallback(&flush_callback_, result);
66 }
67
68 void PPB_VideoDecoder_Shared::RunResetCallback(int32 result) {
69 DCHECK(reset_callback_.func);
70 PP_RunAndClearCompletionCallback(&reset_callback_, result);
71 }
72
73 void PPB_VideoDecoder_Shared::RunBitstreamBufferCallback(
74 int32 bitstream_buffer_id, int32 result) {
75 CallbackById::iterator it =
76 bitstream_buffer_callbacks_.find(bitstream_buffer_id);
77 DCHECK(it != bitstream_buffer_callbacks_.end());
78 PP_CompletionCallback cc = it->second;
79 bitstream_buffer_callbacks_.erase(it);
80 PP_RunCompletionCallback(&cc, PP_OK);
81 }
82
83 void PPB_VideoDecoder_Shared::FlushCommandBuffer() {
84 if (gles2_impl_)
85 gles2_impl_->Flush();
86 }
87
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