| 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 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2171 key_system_string->value(), | 2171 key_system_string->value(), |
| 2172 session_id_string->value(), | 2172 session_id_string->value(), |
| 2173 static_cast<media::Decryptor::KeyError>(media_error), | 2173 static_cast<media::Decryptor::KeyError>(media_error), |
| 2174 system_code); | 2174 system_code); |
| 2175 } | 2175 } |
| 2176 | 2176 |
| 2177 void PluginInstance::DeliverBlock(PP_Instance instance, | 2177 void PluginInstance::DeliverBlock(PP_Instance instance, |
| 2178 PP_Resource decrypted_block, | 2178 PP_Resource decrypted_block, |
| 2179 const PP_DecryptedBlockInfo* block_info) { | 2179 const PP_DecryptedBlockInfo* block_info) { |
| 2180 DCHECK(block_info); | 2180 DCHECK(block_info); |
| 2181 | |
| 2182 DecryptionCBMap::iterator found = pending_decryption_cbs_.find( | 2181 DecryptionCBMap::iterator found = pending_decryption_cbs_.find( |
| 2183 block_info->tracking_info.request_id); | 2182 block_info->tracking_info.request_id); |
| 2184 | |
| 2185 if (found == pending_decryption_cbs_.end()) | 2183 if (found == pending_decryption_cbs_.end()) |
| 2186 return; | 2184 return; |
| 2187 media::Decryptor::DecryptCB decrypt_cb = found->second; | 2185 media::Decryptor::DecryptCB decrypt_cb = found->second; |
| 2188 pending_decryption_cbs_.erase(found); | 2186 pending_decryption_cbs_.erase(found); |
| 2189 | 2187 |
| 2190 if (block_info->result == PP_DECRYPTRESULT_DECRYPT_NOKEY) { | 2188 if (block_info->result == PP_DECRYPTRESULT_DECRYPT_NOKEY) { |
| 2191 decrypt_cb.Run(media::Decryptor::kNoKey, NULL); | 2189 decrypt_cb.Run(media::Decryptor::kNoKey, NULL); |
| 2192 return; | 2190 return; |
| 2193 } | 2191 } |
| 2194 if (block_info->result != PP_DECRYPTRESULT_SUCCESS) { | 2192 if (block_info->result != PP_DECRYPTRESULT_SUCCESS) { |
| 2195 decrypt_cb.Run(media::Decryptor::kError, NULL); | 2193 decrypt_cb.Run(media::Decryptor::kError, NULL); |
| 2196 return; | 2194 return; |
| 2197 } | 2195 } |
| 2196 |
| 2197 ScopedPPResource decrypted_block_scoped(ScopedPPResource::PassRef(), |
| 2198 decrypted_block); |
| 2198 EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true); | 2199 EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true); |
| 2199 | |
| 2200 if (!enter.succeeded()) { | 2200 if (!enter.succeeded()) { |
| 2201 decrypt_cb.Run(media::Decryptor::kError, NULL); | 2201 decrypt_cb.Run(media::Decryptor::kError, NULL); |
| 2202 return; | 2202 return; |
| 2203 } | 2203 } |
| 2204 BufferAutoMapper mapper(enter.object()); | 2204 BufferAutoMapper mapper(enter.object()); |
| 2205 if (!mapper.data() || !mapper.size()) { | 2205 if (!mapper.data() || !mapper.size()) { |
| 2206 decrypt_cb.Run(media::Decryptor::kError, NULL); | 2206 decrypt_cb.Run(media::Decryptor::kError, NULL); |
| 2207 return; | 2207 return; |
| 2208 } | 2208 } |
| 2209 | 2209 |
| 2210 // TODO(tomfinegan): Find a way to take ownership of the shared memory |
| 2211 // managed by the PPB_Buffer_Dev, and avoid the extra copy. |
| 2210 scoped_refptr<media::DecoderBuffer> decrypted_buffer( | 2212 scoped_refptr<media::DecoderBuffer> decrypted_buffer( |
| 2211 media::DecoderBuffer::CopyFrom( | 2213 media::DecoderBuffer::CopyFrom( |
| 2212 reinterpret_cast<const uint8*>(mapper.data()), mapper.size())); | 2214 reinterpret_cast<const uint8*>(mapper.data()), mapper.size())); |
| 2213 decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds( | 2215 decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds( |
| 2214 block_info->tracking_info.timestamp)); | 2216 block_info->tracking_info.timestamp)); |
| 2215 decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer); | 2217 decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer); |
| 2216 } | 2218 } |
| 2217 | 2219 |
| 2218 void PluginInstance::DeliverFrame(PP_Instance instance, | 2220 void PluginInstance::DeliverFrame(PP_Instance instance, |
| 2219 PP_Resource decrypted_frame, | 2221 PP_Resource decrypted_frame, |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2602 screen_size_for_fullscreen_ = gfx::Size(); | 2604 screen_size_for_fullscreen_ = gfx::Size(); |
| 2603 WebElement element = container_->element(); | 2605 WebElement element = container_->element(); |
| 2604 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2606 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2605 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2607 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2606 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2608 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2607 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2609 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2608 } | 2610 } |
| 2609 | 2611 |
| 2610 } // namespace ppapi | 2612 } // namespace ppapi |
| 2611 } // namespace webkit | 2613 } // namespace webkit |
| OLD | NEW |