Chromium Code Reviews| 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2188 pending_decryption_cbs_.erase(found); | 2188 pending_decryption_cbs_.erase(found); |
| 2189 | 2189 |
| 2190 if (block_info->result == PP_DECRYPTRESULT_DECRYPT_NOKEY) { | 2190 if (block_info->result == PP_DECRYPTRESULT_DECRYPT_NOKEY) { |
| 2191 decrypt_cb.Run(media::Decryptor::kNoKey, NULL); | 2191 decrypt_cb.Run(media::Decryptor::kNoKey, NULL); |
| 2192 return; | 2192 return; |
| 2193 } | 2193 } |
| 2194 if (block_info->result != PP_DECRYPTRESULT_SUCCESS) { | 2194 if (block_info->result != PP_DECRYPTRESULT_SUCCESS) { |
| 2195 decrypt_cb.Run(media::Decryptor::kError, NULL); | 2195 decrypt_cb.Run(media::Decryptor::kError, NULL); |
| 2196 return; | 2196 return; |
| 2197 } | 2197 } |
| 2198 EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true); | |
| 2199 | |
| 2200 if (!enter.succeeded()) { | |
| 2201 decrypt_cb.Run(media::Decryptor::kError, NULL); | |
| 2202 return; | |
| 2203 } | |
| 2204 BufferAutoMapper mapper(enter.object()); | |
| 2205 if (!mapper.data() || !mapper.size()) { | |
| 2206 decrypt_cb.Run(media::Decryptor::kError, NULL); | |
| 2207 return; | |
| 2208 } | |
| 2209 | 2198 |
| 2210 scoped_refptr<media::DecoderBuffer> decrypted_buffer( | 2199 EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true); |
| 2211 media::DecoderBuffer::CopyFrom( | 2200 if (enter.succeeded()) { |
| 2212 reinterpret_cast<const uint8*>(mapper.data()), mapper.size())); | 2201 BufferAutoMapper mapper(enter.object()); |
| 2213 decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds( | 2202 if (!mapper.data() || !mapper.size()) { |
| 2214 block_info->tracking_info.timestamp)); | 2203 decrypt_cb.Run(media::Decryptor::kError, NULL); |
| 2215 decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer); | 2204 return; |
| 2205 } | |
| 2206 | |
| 2207 scoped_refptr<media::DecoderBuffer> decrypted_buffer( | |
| 2208 media::DecoderBuffer::CopyFrom( | |
| 2209 reinterpret_cast<const uint8*>(mapper.data()), mapper.size())); | |
| 2210 decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds( | |
| 2211 block_info->tracking_info.timestamp)); | |
| 2212 decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer); | |
| 2213 } else { | |
| 2214 decrypt_cb.Run(media::Decryptor::kError, NULL); | |
|
ddorwin
2012/09/05 08:44:44
Why aren't you returning early (if(!succeeded)) an
| |
| 2215 return; | |
| 2216 } | |
| 2217 | |
| 2218 PluginModule::GetCore()->ReleaseResource(decrypted_block); | |
|
ddorwin
2012/09/05 08:44:44
Does the browser not always take ownership? What h
xhwang
2012/09/05 09:26:55
Agreed. Is there something like scoped_resource we
| |
| 2216 } | 2219 } |
| 2217 | 2220 |
| 2218 void PluginInstance::DeliverFrame(PP_Instance instance, | 2221 void PluginInstance::DeliverFrame(PP_Instance instance, |
| 2219 PP_Resource decrypted_frame, | 2222 PP_Resource decrypted_frame, |
| 2220 const PP_DecryptedBlockInfo* block_info) { | 2223 const PP_DecryptedBlockInfo* block_info) { |
| 2221 // TODO(tomfinegan): To be implemented after completion of v0.1 of the | 2224 // TODO(tomfinegan): To be implemented after completion of v0.1 of the |
| 2222 // EME/CDM work. | 2225 // EME/CDM work. |
| 2223 } | 2226 } |
| 2224 | 2227 |
| 2225 void PluginInstance::DeliverSamples(PP_Instance instance, | 2228 void PluginInstance::DeliverSamples(PP_Instance instance, |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2602 screen_size_for_fullscreen_ = gfx::Size(); | 2605 screen_size_for_fullscreen_ = gfx::Size(); |
| 2603 WebElement element = container_->element(); | 2606 WebElement element = container_->element(); |
| 2604 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2607 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2605 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2608 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2606 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2609 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2607 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2610 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2608 } | 2611 } |
| 2609 | 2612 |
| 2610 } // namespace ppapi | 2613 } // namespace ppapi |
| 2611 } // namespace webkit | 2614 } // namespace webkit |
| OLD | NEW |