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 11 matching lines...) Expand all Loading... |
22 const HostResource& host_resource) | 22 const HostResource& host_resource) |
23 : Resource(OBJECT_IS_PROXY, host_resource), | 23 : Resource(OBJECT_IS_PROXY, host_resource), |
24 graphics_context_(0), | 24 graphics_context_(0), |
25 gles2_impl_(NULL) {} | 25 gles2_impl_(NULL) {} |
26 | 26 |
27 PPB_VideoDecoder_Shared::~PPB_VideoDecoder_Shared() { | 27 PPB_VideoDecoder_Shared::~PPB_VideoDecoder_Shared() { |
28 // Destroy() must be called before the object is destroyed. | 28 // Destroy() must be called before the object is destroyed. |
29 DCHECK(graphics_context_ == 0); | 29 DCHECK(graphics_context_ == 0); |
30 } | 30 } |
31 | 31 |
32 thunk::PPB_VideoDecoder_API* PPB_VideoDecoder_Shared::AsPPB_VideoDecoder_API() { | 32 thunk::PPB_VideoDecoder_Dev_API* |
| 33 PPB_VideoDecoder_Shared::AsPPB_VideoDecoder_Dev_API() { |
33 return this; | 34 return this; |
34 } | 35 } |
35 | 36 |
36 void PPB_VideoDecoder_Shared::InitCommon( | 37 void PPB_VideoDecoder_Shared::InitCommon( |
37 PP_Resource graphics_context, | 38 PP_Resource graphics_context, |
38 gpu::gles2::GLES2Implementation* gles2_impl) { | 39 gpu::gles2::GLES2Implementation* gles2_impl) { |
39 DCHECK(graphics_context); | 40 DCHECK(graphics_context); |
40 DCHECK(!gles2_impl_ && !graphics_context_); | 41 DCHECK(!gles2_impl_ && !graphics_context_); |
41 gles2_impl_ = gles2_impl; | 42 gles2_impl_ = gles2_impl; |
42 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(graphics_context); | 43 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(graphics_context); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // 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 |
100 // DidDeleteInstance() has been called. | 101 // DidDeleteInstance() has been called. |
101 if (PpapiGlobals::Get()->GetResourceTracker()->GetResource( | 102 if (PpapiGlobals::Get()->GetResourceTracker()->GetResource( |
102 graphics_context_)) { | 103 graphics_context_)) { |
103 if (gles2_impl_) | 104 if (gles2_impl_) |
104 gles2_impl_->Flush(); | 105 gles2_impl_->Flush(); |
105 } | 106 } |
106 } | 107 } |
107 | 108 |
108 } // namespace ppapi | 109 } // namespace ppapi |
OLD | NEW |