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 26 matching lines...) Expand all Loading... | |
37 PP_Resource graphics_context, | 37 PP_Resource graphics_context, |
38 gpu::gles2::GLES2Implementation* gles2_impl) { | 38 gpu::gles2::GLES2Implementation* gles2_impl) { |
39 DCHECK(graphics_context); | 39 DCHECK(graphics_context); |
40 DCHECK(!gles2_impl_ && !graphics_context_); | 40 DCHECK(!gles2_impl_ && !graphics_context_); |
41 gles2_impl_ = gles2_impl; | 41 gles2_impl_ = gles2_impl; |
42 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(graphics_context); | 42 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(graphics_context); |
43 graphics_context_ = graphics_context; | 43 graphics_context_ = graphics_context; |
44 } | 44 } |
45 | 45 |
46 void PPB_VideoDecoder_Shared::Destroy() { | 46 void PPB_VideoDecoder_Shared::Destroy() { |
47 graphics_context_ = 0; | 47 if (graphics_context_) { |
48 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource( | |
49 graphics_context_); | |
dmichael (off chromium)
2013/03/27 22:59:04
What about either using ScopedPPResource, or actua
danakj
2013/03/27 23:02:33
Will ScopedPPResource work with this model where D
dmichael (off chromium)
2013/03/28 02:40:49
Didn't see that ScopedPPResource has no public way
danakj
2013/03/28 15:58:50
I feel hesitant to make that change as it would be
| |
50 graphics_context_ = 0; | |
51 } | |
48 gles2_impl_ = NULL; | 52 gles2_impl_ = NULL; |
49 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(graphics_context_); | |
50 } | 53 } |
51 | 54 |
52 bool PPB_VideoDecoder_Shared::SetFlushCallback( | 55 bool PPB_VideoDecoder_Shared::SetFlushCallback( |
53 scoped_refptr<TrackedCallback> callback) { | 56 scoped_refptr<TrackedCallback> callback) { |
54 if (TrackedCallback::IsPending(flush_callback_)) | 57 if (TrackedCallback::IsPending(flush_callback_)) |
55 return false; | 58 return false; |
56 flush_callback_ = callback; | 59 flush_callback_ = callback; |
57 return true; | 60 return true; |
58 } | 61 } |
59 | 62 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 graphics_context_, false); | 100 graphics_context_, false); |
98 DCHECK(enter_g3d.succeeded()); | 101 DCHECK(enter_g3d.succeeded()); |
99 PPB_Graphics3D_Shared* graphics3d = | 102 PPB_Graphics3D_Shared* graphics3d = |
100 static_cast<PPB_Graphics3D_Shared*>(enter_g3d.object()); | 103 static_cast<PPB_Graphics3D_Shared*>(enter_g3d.object()); |
101 PPB_Graphics3D_Shared::ScopedNoLocking dont_lock(graphics3d); | 104 PPB_Graphics3D_Shared::ScopedNoLocking dont_lock(graphics3d); |
102 gles2_impl_->Flush(); | 105 gles2_impl_->Flush(); |
103 } | 106 } |
104 } | 107 } |
105 | 108 |
106 } // namespace ppapi | 109 } // namespace ppapi |
OLD | NEW |