| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ppb_video_decoder_shared.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/ppb_graphics_3d_shared.h" | 10 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 bool PPB_VideoDecoder_Shared::SetResetCallback( | 64 bool PPB_VideoDecoder_Shared::SetResetCallback( |
| 65 scoped_refptr<TrackedCallback> callback) { | 65 scoped_refptr<TrackedCallback> callback) { |
| 66 if (TrackedCallback::IsPending(reset_callback_)) | 66 if (TrackedCallback::IsPending(reset_callback_)) |
| 67 return false; | 67 return false; |
| 68 reset_callback_ = callback; | 68 reset_callback_ = callback; |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 bool PPB_VideoDecoder_Shared::SetBitstreamBufferCallback( | 72 bool PPB_VideoDecoder_Shared::SetBitstreamBufferCallback( |
| 73 int32 bitstream_buffer_id, | 73 int32_t bitstream_buffer_id, |
| 74 scoped_refptr<TrackedCallback> callback) { | 74 scoped_refptr<TrackedCallback> callback) { |
| 75 return bitstream_buffer_callbacks_.insert(std::make_pair(bitstream_buffer_id, | 75 return bitstream_buffer_callbacks_.insert(std::make_pair(bitstream_buffer_id, |
| 76 callback)).second; | 76 callback)).second; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void PPB_VideoDecoder_Shared::RunFlushCallback(int32 result) { | 79 void PPB_VideoDecoder_Shared::RunFlushCallback(int32_t result) { |
| 80 flush_callback_->Run(result); | 80 flush_callback_->Run(result); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void PPB_VideoDecoder_Shared::RunResetCallback(int32 result) { | 83 void PPB_VideoDecoder_Shared::RunResetCallback(int32_t result) { |
| 84 reset_callback_->Run(result); | 84 reset_callback_->Run(result); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void PPB_VideoDecoder_Shared::RunBitstreamBufferCallback( | 87 void PPB_VideoDecoder_Shared::RunBitstreamBufferCallback( |
| 88 int32 bitstream_buffer_id, | 88 int32_t bitstream_buffer_id, |
| 89 int32 result) { | 89 int32_t result) { |
| 90 CallbackById::iterator it = | 90 CallbackById::iterator it = |
| 91 bitstream_buffer_callbacks_.find(bitstream_buffer_id); | 91 bitstream_buffer_callbacks_.find(bitstream_buffer_id); |
| 92 DCHECK(it != bitstream_buffer_callbacks_.end()); | 92 DCHECK(it != bitstream_buffer_callbacks_.end()); |
| 93 scoped_refptr<TrackedCallback> cc = it->second; | 93 scoped_refptr<TrackedCallback> cc = it->second; |
| 94 bitstream_buffer_callbacks_.erase(it); | 94 bitstream_buffer_callbacks_.erase(it); |
| 95 cc->Run(PP_OK); | 95 cc->Run(PP_OK); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void PPB_VideoDecoder_Shared::FlushCommandBuffer() { | 98 void PPB_VideoDecoder_Shared::FlushCommandBuffer() { |
| 99 // Ensure that graphics_context is still live before using gles2_impl_. | 99 // Ensure that graphics_context is still live before using gles2_impl_. |
| 100 // Our "plugin reference" is not enough to keep graphics_context alive if | 100 // Our "plugin reference" is not enough to keep graphics_context alive if |
| 101 // DidDeleteInstance() has been called. | 101 // DidDeleteInstance() has been called. |
| 102 if (PpapiGlobals::Get()->GetResourceTracker()->GetResource( | 102 if (PpapiGlobals::Get()->GetResourceTracker()->GetResource( |
| 103 graphics_context_)) { | 103 graphics_context_)) { |
| 104 if (gles2_impl_) | 104 if (gles2_impl_) |
| 105 gles2_impl_->Flush(); | 105 gles2_impl_->Flush(); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace ppapi | 109 } // namespace ppapi |
| OLD | NEW |