diff options
author | Torne (Richard Coles) <torne@google.com> | 2013-10-31 11:16:26 +0000 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2013-10-31 11:16:26 +0000 |
commit | 1e9bf3e0803691d0a228da41fc608347b6db4340 (patch) | |
tree | ab2e5565f71b4219b3da406e19f16fe306704ef5 /ppapi | |
parent | f10b58d5bc6ae3e74076fc4ccca14cbc57ef805c (diff) | |
download | chromium_org-1e9bf3e0803691d0a228da41fc608347b6db4340.tar.gz |
Merge from Chromium at DEPS revision 232015
This commit was generated by merge_to_master.py.
Change-Id: If86767ad396b9e2e1a4c1e9df1427daea29703ef
Diffstat (limited to 'ppapi')
37 files changed, 316 insertions, 234 deletions
diff --git a/ppapi/api/dev/ppb_video_decoder_dev.idl b/ppapi/api/dev/ppb_video_decoder_dev.idl index 5b1a94eaa1..da408c94fc 100644 --- a/ppapi/api/dev/ppb_video_decoder_dev.idl +++ b/ppapi/api/dev/ppb_video_decoder_dev.idl @@ -62,7 +62,8 @@ interface PPB_VideoDecoder_Dev { * * Parameters: * |video_decoder| is the previously created handle to the decoder resource. - * |bitstream_buffer| is the bitstream buffer that contains the input data. + * |bitstream_buffer| is the bitstream buffer that contains at most one + * input frame. * |callback| will be called when |bitstream_buffer| has been processed by * the decoder. * diff --git a/ppapi/api/pp_array_output.idl b/ppapi/api/pp_array_output.idl index be1aca7bf8..8e04a4cc9d 100644 --- a/ppapi/api/pp_array_output.idl +++ b/ppapi/api/pp_array_output.idl @@ -9,7 +9,7 @@ * * This function will be called reentrantly. This means that if you call a * function PPB_Foo.GetData(&array_output), GetData will call your - * GetDataBuffer function before it returns. + * GetDataBuffer function before it returns. * * This function will be called even when returning 0-length arrays, so be sure * your implementation can support that. You can return NULL for 0 length @@ -34,7 +34,10 @@ * @param element_size The size of each element in bytes. * * @return Returns a pointer to the allocated memory. On failure, returns null. - * You can also return null if the element_count is 0. + * You can also return null if the element_count is 0. When a non-null value is + * returned, the buffer must remain valid until after the callback runs. If used + * with a blocking callback, the buffer must remain valid until after the + * function returns. The plugin can then free any memory that it allocated. */ typedef mem_t PP_ArrayOutput_GetDataBuffer([inout] mem_t user_data, [in] uint32_t element_count, @@ -78,7 +81,7 @@ typedef mem_t PP_ArrayOutput_GetDataBuffer([inout] mem_t user_data, [passByValue] struct PP_ArrayOutput { /** - * A pointer to the allocation function that the browser implements. + * A pointer to the allocation function that the browser will call. */ PP_ArrayOutput_GetDataBuffer GetDataBuffer; diff --git a/ppapi/api/ppb_file_io.idl b/ppapi/api/ppb_file_io.idl index 2e43ec54c1..9b8c9e22bd 100644 --- a/ppapi/api/ppb_file_io.idl +++ b/ppapi/api/ppb_file_io.idl @@ -121,7 +121,9 @@ interface PPB_FileIO { * @param[out] info The <code>PP_FileInfo</code> structure representing all * information about the file. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon - * completion of Query(). + * completion of Query(). <code>info</code> must remain valid until after the + * callback runs. If you pass a blocking callback, <code>info</code> must + * remain valid until after Query() returns. * * @return An int32_t containing an error code from <code>pp_errors.h</code>. * PP_ERROR_FAILED will be returned if the file isn't opened, and @@ -158,6 +160,7 @@ interface PPB_FileIO { * large enough to hold the specified number of bytes to read. This function * might perform a partial read, meaning all the requested bytes * might not be returned, even if the end of the file has not been reached. + * The FileIO object must have been opened with read access. * * ReadToArray() is preferred to Read() when doing asynchronous operations. * @@ -168,7 +171,9 @@ interface PPB_FileIO { * @param[in] bytes_to_read The number of bytes to read from * <code>offset</code>. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon - * completion of Read(). + * completion of Read(). <code>buffer</code> must remain valid until after + * the callback runs. If you pass a blocking callback, <code>buffer</code> + * must remain valid until after Read() returns. * * @return The number of bytes read or an error code from * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was @@ -260,7 +265,8 @@ interface PPB_FileIO { /** * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be * provided so that output will be stored in its allocated buffer. This - * function might perform a partial read. + * function might perform a partial read. The FileIO object must have been + * opened with read access. * * @param[in] file_io A <code>PP_Resource</code> corresponding to a file * FileIO. diff --git a/ppapi/api/private/pp_content_decryptor.idl b/ppapi/api/private/pp_content_decryptor.idl index aba404f8bb..41a3997408 100644 --- a/ppapi/api/private/pp_content_decryptor.idl +++ b/ppapi/api/private/pp_content_decryptor.idl @@ -140,6 +140,20 @@ enum PP_DecryptedFrameFormat { }; /** + * <code>PP_DecryptedSampleFormat</code> contains audio sample formats. + */ +[assert_size(4)] +enum PP_DecryptedSampleFormat { + PP_DECRYPTEDSAMPLEFORMAT_UNKNOWN = 0, + PP_DECRYPTEDSAMPLEFORMAT_U8 = 1, + PP_DECRYPTEDSAMPLEFORMAT_S16 = 2, + PP_DECRYPTEDSAMPLEFORMAT_S32 = 3, + PP_DECRYPTEDSAMPLEFORMAT_F32 = 4, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_S16 = 5, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_F32 = 6 +}; + +/** * The <code>PP_DecryptResult</code> enum contains decryption and decoding * result constants. */ @@ -235,6 +249,40 @@ struct PP_DecryptedFrameInfo { }; /** + * <code>PP_DecryptedSampleInfo</code> contains the result of the + * decrypt and decode operation on the associated samples, information required + * to access the sample data in buffer, and tracking info. + */ +[assert_size(32)] +struct PP_DecryptedSampleInfo { + /** + * Result of the decrypt and decode operation. + */ + PP_DecryptResult result; + + /** + * Format of the decrypted samples. + */ + PP_DecryptedSampleFormat format; + + /** + * Size in bytes of decrypted samples. + */ + uint32_t data_size; + + /** + * 4-byte padding to make the size of <code>PP_DecryptedSampleInfo</code> + * a multiple of 8 bytes. The value of this field should not be used. + */ + uint32_t padding; + + /** + * Information needed by the client to track the decrypted samples. + */ + PP_DecryptTrackingInfo tracking_info; +}; + +/** * <code>PP_AudioCodec</code> contains audio codec type constants. */ [assert_size(4)] diff --git a/ppapi/api/private/ppb_content_decryptor_private.idl b/ppapi/api/private/ppb_content_decryptor_private.idl index 8859448d68..fbf46636e9 100644 --- a/ppapi/api/private/ppb_content_decryptor_private.idl +++ b/ppapi/api/private/ppb_content_decryptor_private.idl @@ -12,7 +12,8 @@ [generate_thunk] label Chrome { - M31 = 0.7 + M31 = 0.7, + M32 = 0.8 }; /** @@ -228,12 +229,12 @@ interface PPB_ContentDecryptor_Private { * <code>PPB_Buffer_Dev</code> resource that contains a decrypted buffer * of decoded audio samples. * - * @param[in] decrypted_block_info A <code>PP_DecryptedBlockInfo</code> that - * contains the tracking info and result code associated with the - * <code>decrypted_block</code>. + * @param[in] decrypted_sample_info A <code>PP_DecryptedSampleInfo</code> that + * contains the tracking info and result code associated with the decrypted + * samples. */ void DeliverSamples( [in] PP_Instance instance, [in] PP_Resource audio_frames, - [in] PP_DecryptedBlockInfo decrypted_block_info); + [in] PP_DecryptedSampleInfo decrypted_sample_info); }; diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl index 4bb602f59c..3b965e9b63 100644 --- a/ppapi/api/private/ppb_nacl_private.idl +++ b/ppapi/api/private/ppb_nacl_private.idl @@ -147,10 +147,6 @@ interface PPB_NaCl_Private { */ PP_Bool IsOffTheRecord(); - /* Return true if PNaCl is turned on. - */ - PP_Bool IsPnaclEnabled(); - /* Display a UI message to the user. */ PP_ExternalPluginResult ReportNaClError([in] PP_Instance instance, [in] PP_NaClError message_id); diff --git a/ppapi/c/dev/ppb_video_decoder_dev.h b/ppapi/c/dev/ppb_video_decoder_dev.h index fa57fd42ec..8b15fb07d1 100644 --- a/ppapi/c/dev/ppb_video_decoder_dev.h +++ b/ppapi/c/dev/ppb_video_decoder_dev.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From dev/ppb_video_decoder_dev.idl modified Wed Dec 14 18:08:00 2011. */ +/* From dev/ppb_video_decoder_dev.idl modified Tue Oct 29 00:32:59 2013. */ #ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ #define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ @@ -78,7 +78,8 @@ struct PPB_VideoDecoder_Dev_0_16 { * * Parameters: * |video_decoder| is the previously created handle to the decoder resource. - * |bitstream_buffer| is the bitstream buffer that contains the input data. + * |bitstream_buffer| is the bitstream buffer that contains at most one + * input frame. * |callback| will be called when |bitstream_buffer| has been processed by * the decoder. * diff --git a/ppapi/c/pp_array_output.h b/ppapi/c/pp_array_output.h index add873cf8d..2272a8f26e 100644 --- a/ppapi/c/pp_array_output.h +++ b/ppapi/c/pp_array_output.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From pp_array_output.idl modified Thu Mar 28 11:07:53 2013. */ +/* From pp_array_output.idl modified Tue Oct 22 15:09:25 2013. */ #ifndef PPAPI_C_PP_ARRAY_OUTPUT_H_ #define PPAPI_C_PP_ARRAY_OUTPUT_H_ @@ -43,7 +43,10 @@ * @param element_size The size of each element in bytes. * * @return Returns a pointer to the allocated memory. On failure, returns null. - * You can also return null if the element_count is 0. + * You can also return null if the element_count is 0. When a non-null value is + * returned, the buffer must remain valid until after the callback runs. If used + * with a blocking callback, the buffer must remain valid until after the + * function returns. The plugin can then free any memory that it allocated. */ @@ -99,7 +102,7 @@ typedef void* (*PP_ArrayOutput_GetDataBuffer)(void* user_data, */ struct PP_ArrayOutput { /** - * A pointer to the allocation function that the browser implements. + * A pointer to the allocation function that the browser will call. */ PP_ArrayOutput_GetDataBuffer GetDataBuffer; /** diff --git a/ppapi/c/ppb_file_io.h b/ppapi/c/ppb_file_io.h index fe0e1bd4bb..8f272bf5a0 100644 --- a/ppapi/c/ppb_file_io.h +++ b/ppapi/c/ppb_file_io.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_file_io.idl modified Tue Jun 11 15:21:38 2013. */ +/* From ppb_file_io.idl modified Tue Oct 22 15:09:47 2013. */ #ifndef PPAPI_C_PPB_FILE_IO_H_ #define PPAPI_C_PPB_FILE_IO_H_ @@ -135,7 +135,9 @@ struct PPB_FileIO_1_1 { * @param[out] info The <code>PP_FileInfo</code> structure representing all * information about the file. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon - * completion of Query(). + * completion of Query(). <code>info</code> must remain valid until after the + * callback runs. If you pass a blocking callback, <code>info</code> must + * remain valid until after Query() returns. * * @return An int32_t containing an error code from <code>pp_errors.h</code>. * PP_ERROR_FAILED will be returned if the file isn't opened, and @@ -170,6 +172,7 @@ struct PPB_FileIO_1_1 { * large enough to hold the specified number of bytes to read. This function * might perform a partial read, meaning all the requested bytes * might not be returned, even if the end of the file has not been reached. + * The FileIO object must have been opened with read access. * * ReadToArray() is preferred to Read() when doing asynchronous operations. * @@ -180,7 +183,9 @@ struct PPB_FileIO_1_1 { * @param[in] bytes_to_read The number of bytes to read from * <code>offset</code>. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon - * completion of Read(). + * completion of Read(). <code>buffer</code> must remain valid until after + * the callback runs. If you pass a blocking callback, <code>buffer</code> + * must remain valid until after Read() returns. * * @return The number of bytes read or an error code from * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was @@ -267,7 +272,8 @@ struct PPB_FileIO_1_1 { /** * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be * provided so that output will be stored in its allocated buffer. This - * function might perform a partial read. + * function might perform a partial read. The FileIO object must have been + * opened with read access. * * @param[in] file_io A <code>PP_Resource</code> corresponding to a file * FileIO. diff --git a/ppapi/c/private/pp_content_decryptor.h b/ppapi/c/private/pp_content_decryptor.h index 43ea559f12..a282abbf3a 100644 --- a/ppapi/c/private/pp_content_decryptor.h +++ b/ppapi/c/private/pp_content_decryptor.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/pp_content_decryptor.idl modified Tue Dec 4 16:42:46 2012. */ +/* From private/pp_content_decryptor.idl modified Mon Oct 21 18:38:44 2013. */ #ifndef PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_ #define PPAPI_C_PRIVATE_PP_CONTENT_DECRYPTOR_H_ @@ -153,6 +153,20 @@ typedef enum { PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedFrameFormat, 4); /** + * <code>PP_DecryptedSampleFormat</code> contains audio sample formats. + */ +typedef enum { + PP_DECRYPTEDSAMPLEFORMAT_UNKNOWN = 0, + PP_DECRYPTEDSAMPLEFORMAT_U8 = 1, + PP_DECRYPTEDSAMPLEFORMAT_S16 = 2, + PP_DECRYPTEDSAMPLEFORMAT_S32 = 3, + PP_DECRYPTEDSAMPLEFORMAT_F32 = 4, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_S16 = 5, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_F32 = 6 +} PP_DecryptedSampleFormat; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedSampleFormat, 4); + +/** * The <code>PP_DecryptResult</code> enum contains decryption and decoding * result constants. */ @@ -259,6 +273,36 @@ struct PP_DecryptedFrameInfo { struct PP_DecryptTrackingInfo tracking_info; }; PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedFrameInfo, 56); + +/** + * <code>PP_DecryptedSampleInfo</code> contains the result of the + * decrypt and decode operation on the associated samples, information required + * to access the sample data in buffer, and tracking info. + */ +struct PP_DecryptedSampleInfo { + /** + * Result of the decrypt and decode operation. + */ + PP_DecryptResult result; + /** + * Format of the decrypted samples. + */ + PP_DecryptedSampleFormat format; + /** + * Size in bytes of decrypted samples. + */ + uint32_t data_size; + /** + * 4-byte padding to make the size of <code>PP_DecryptedSampleInfo</code> + * a multiple of 8 bytes. The value of this field should not be used. + */ + uint32_t padding; + /** + * Information needed by the client to track the decrypted samples. + */ + struct PP_DecryptTrackingInfo tracking_info; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedSampleInfo, 32); /** * @} */ diff --git a/ppapi/c/private/ppb_content_decryptor_private.h b/ppapi/c/private/ppb_content_decryptor_private.h index 86f239aab1..5e3d1aa4df 100644 --- a/ppapi/c/private/ppb_content_decryptor_private.h +++ b/ppapi/c/private/ppb_content_decryptor_private.h @@ -4,7 +4,7 @@ */ /* From private/ppb_content_decryptor_private.idl, - * modified Tue Sep 17 11:31:05 2013. + * modified Thu Oct 10 14:49:51 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_ @@ -234,14 +234,14 @@ struct PPB_ContentDecryptor_Private_0_7 { * <code>PPB_Buffer_Dev</code> resource that contains a decrypted buffer * of decoded audio samples. * - * @param[in] decrypted_block_info A <code>PP_DecryptedBlockInfo</code> that - * contains the tracking info and result code associated with the - * <code>decrypted_block</code>. + * @param[in] decrypted_sample_info A <code>PP_DecryptedSampleInfo</code> that + * contains the tracking info and result code associated with the decrypted + * samples. */ void (*DeliverSamples)( PP_Instance instance, PP_Resource audio_frames, - const struct PP_DecryptedBlockInfo* decrypted_block_info); + const struct PP_DecryptedSampleInfo* decrypted_sample_info); }; typedef struct PPB_ContentDecryptor_Private_0_7 PPB_ContentDecryptor_Private; diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h index 6441efd59b..923e9cb81d 100644 --- a/ppapi/c/private/ppb_nacl_private.h +++ b/ppapi/c/private/ppb_nacl_private.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From private/ppb_nacl_private.idl modified Thu Aug 29 17:42:12 2013. */ +/* From private/ppb_nacl_private.idl modified Fri Oct 18 08:23:34 2013. */ #ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ #define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ @@ -159,9 +159,6 @@ struct PPB_NaCl_Private_1_0 { /* Return true if we are off the record. */ PP_Bool (*IsOffTheRecord)(void); - /* Return true if PNaCl is turned on. - */ - PP_Bool (*IsPnaclEnabled)(void); /* Display a UI message to the user. */ PP_ExternalPluginResult (*ReportNaClError)(PP_Instance instance, PP_NaClError message_id); diff --git a/ppapi/cpp/file_io.h b/ppapi/cpp/file_io.h index 99d8ce74d9..bbd6b57b9e 100644 --- a/ppapi/cpp/file_io.h +++ b/ppapi/cpp/file_io.h @@ -71,7 +71,9 @@ class FileIO : public Resource { /// @param[in] result_buf The <code>PP_FileInfo</code> structure representing /// all information about the file. /// @param[in] cc A <code>CompletionCallback</code> to be called upon - /// completion of Query(). + /// completion of Query(). <code>result_buf</code> must remain valid until + /// after the callback runs. If you pass a blocking callback, + /// <code>result_buf</code> must remain valid until after Query() returns. /// /// @return An int32_t containing an error code from /// <code>pp_errors.h</code>. @@ -138,7 +140,9 @@ class FileIO : public Resource { /// @param[in] bytes_to_read The number of bytes to read from /// <code>offset</code>. /// @param[in] cc A <code>CompletionCallback</code> to be called upon - /// completion of Read(). + /// completion of Read(). <code>buffer</code> must remain valid until after + /// the callback runs. If you pass a blocking callback, <code>buffer</code> + /// must remain valid until after Read() returns. /// /// @return An The number of bytes read an error code from /// <code>pp_errors.h</code>. If the return value is 0, then end-of-file was diff --git a/ppapi/cpp/file_ref.h b/ppapi/cpp/file_ref.h index 56828f7e64..452d2a6132 100644 --- a/ppapi/cpp/file_ref.h +++ b/ppapi/cpp/file_ref.h @@ -46,6 +46,9 @@ class FileRef : public Resource { /// A constructor that creates a weak pointer to a file in the given file /// system. File paths are POSIX style. /// + /// If the <code>path</code> is malformed, the resulting <code>FileRef</code> + /// will have a null <code>PP_Resource</code>. + /// /// @param[in] file_system A <code>FileSystem</code> corresponding to a file /// system type. /// @param[in] path A path to the file. Must begin with a '/' character. diff --git a/ppapi/cpp/private/content_decryptor_private.cc b/ppapi/cpp/private/content_decryptor_private.cc index 23417c3e15..8c7dcd2850 100644 --- a/ppapi/cpp/private/content_decryptor_private.cc +++ b/ppapi/cpp/private/content_decryptor_private.cc @@ -330,12 +330,12 @@ void ContentDecryptor_Private::DeliverFrame( void ContentDecryptor_Private::DeliverSamples( pp::Buffer_Dev audio_frames, - const PP_DecryptedBlockInfo& decrypted_block_info) { + const PP_DecryptedSampleInfo& decrypted_sample_info) { if (has_interface<PPB_ContentDecryptor_Private>()) { get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( associated_instance_.pp_instance(), audio_frames.pp_resource(), - &decrypted_block_info); + &decrypted_sample_info); } } diff --git a/ppapi/cpp/private/content_decryptor_private.h b/ppapi/cpp/private/content_decryptor_private.h index a43a74cfb8..ff985691e1 100644 --- a/ppapi/cpp/private/content_decryptor_private.h +++ b/ppapi/cpp/private/content_decryptor_private.h @@ -94,7 +94,7 @@ class ContentDecryptor_Private { // provided to DecryptAndDecode() when it calls this method. The browser will // reuse the buffer in a subsequent DecryptAndDecode() call. void DeliverSamples(pp::Buffer_Dev audio_frames, - const PP_DecryptedBlockInfo& decrypted_block_info); + const PP_DecryptedSampleInfo& decrypted_sample_info); private: InstanceHandle associated_instance_; diff --git a/ppapi/host/resource_message_filter_unittest.cc b/ppapi/host/resource_message_filter_unittest.cc index 78fc23cf6b..38fd9d8f50 100644 --- a/ppapi/host/resource_message_filter_unittest.cc +++ b/ppapi/host/resource_message_filter_unittest.cc @@ -64,8 +64,7 @@ class MyResourceHost : public ResourceHost { HostMessageContext* context) OVERRIDE { last_handled_msg_ = msg; if (msg.type() == msg_type_) { - context->reply_msg = IPC::Message(0, reply_msg_type_, - IPC::Message::PRIORITY_NORMAL); + context->reply_msg = IPC::Message(0, reply_msg_type_); return PP_OK; } return PP_ERROR_FAILED; @@ -123,8 +122,7 @@ class MyResourceFilter : public ResourceMessageFilter { last_handled_msg_ = msg; last_message_loop_ = base::MessageLoop::current(); if (msg.type() == msg_type_) { - context->reply_msg = IPC::Message(0, reply_msg_type_, - IPC::Message::PRIORITY_NORMAL); + context->reply_msg = IPC::Message(0, reply_msg_type_); return PP_OK; } return PP_ERROR_FAILED; @@ -166,9 +164,9 @@ TEST_F(ResourceMessageFilterTest, TestHandleMessage) { proxy::ResourceMessageCallParams params(resource, 1); params.set_has_callback(); HostMessageContext context(params); - IPC::Message message1(0, MSG1_TYPE, IPC::Message::PRIORITY_NORMAL); - IPC::Message message2(0, MSG2_TYPE, IPC::Message::PRIORITY_NORMAL); - IPC::Message message3(0, MSG3_TYPE, IPC::Message::PRIORITY_NORMAL); + IPC::Message message1(0, MSG1_TYPE); + IPC::Message message2(0, MSG2_TYPE); + IPC::Message message3(0, MSG3_TYPE); // Message 1 handled by the first filter. host.HandleMessage(message1, &context); diff --git a/ppapi/native_client/src/trusted/plugin/file_downloader.cc b/ppapi/native_client/src/trusted/plugin/file_downloader.cc index 4bc1d4a673..f8d3a4c457 100644 --- a/ppapi/native_client/src/trusted/plugin/file_downloader.cc +++ b/ppapi/native_client/src/trusted/plugin/file_downloader.cc @@ -112,6 +112,9 @@ bool FileDownloader::Open( if (!instance_->DocumentCanRequest(url)) url_request.SetAllowCrossOriginRequests(true); + if (!extra_request_headers_.empty()) + url_request.SetHeaders(extra_request_headers_); + do { // Reset the url loader and file reader. // Note that we have the only reference to the underlying objects, so diff --git a/ppapi/native_client/src/trusted/plugin/file_downloader.h b/ppapi/native_client/src/trusted/plugin/file_downloader.h index 23f202cb08..4fd7997cc9 100644 --- a/ppapi/native_client/src/trusted/plugin/file_downloader.h +++ b/ppapi/native_client/src/trusted/plugin/file_downloader.h @@ -149,6 +149,11 @@ class FileDownloader { int status_code() const { return status_code_; } nacl::string GetResponseHeaders() const; + void set_request_headers(const nacl::string& extra_request_headers) { + extra_request_headers_ = extra_request_headers; + } + + private: NACL_DISALLOW_COPY_AND_ASSIGN(FileDownloader); // This class loads and opens the file in three steps for DOWNLOAD_TO_FILE: @@ -175,6 +180,7 @@ class FileDownloader { Plugin* instance_; nacl::string url_to_open_; nacl::string url_; + nacl::string extra_request_headers_; pp::URLResponseInfo url_response_; pp::CompletionCallback file_open_notify_callback_; pp::CompletionCallback stream_finish_callback_; diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index 8fb4c43c11..5a783af4af 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -29,28 +29,14 @@ #include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" #include "native_client/src/trusted/service_runtime/nacl_error_code.h" -#include "ppapi/c/dev/ppp_find_dev.h" -#include "ppapi/c/dev/ppp_printing_dev.h" -#include "ppapi/c/dev/ppp_selection_dev.h" -#include "ppapi/c/dev/ppp_zoom_dev.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_console.h" #include "ppapi/c/ppb_var.h" -#include "ppapi/c/ppp_input_event.h" #include "ppapi/c/ppp_instance.h" -#include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/c/private/ppb_nacl_private.h" #include "ppapi/c/private/ppb_uma_private.h" -#include "ppapi/cpp/dev/find_dev.h" -#include "ppapi/cpp/dev/printing_dev.h" -#include "ppapi/cpp/dev/selection_dev.h" #include "ppapi/cpp/dev/url_util_dev.h" -#include "ppapi/cpp/dev/zoom_dev.h" -#include "ppapi/cpp/image_data.h" -#include "ppapi/cpp/input_event.h" #include "ppapi/cpp/module.h" -#include "ppapi/cpp/mouse_lock.h" -#include "ppapi/cpp/rect.h" #include "ppapi/cpp/text_input_controller.h" #include "ppapi/native_client/src/trusted/plugin/file_utils.h" @@ -300,11 +286,12 @@ void Plugin::GetLastError(NaClSrpcArg* prop_value) { void Plugin::GetReadyStateProperty(NaClSrpcArg* prop_value) { PLUGIN_PRINTF(("GetReadyState (this=%p)\n", reinterpret_cast<void*>(this))); prop_value->tag = NACL_SRPC_ARG_TYPE_INT; - prop_value->u.ival = nacl_ready_state(); + prop_value->u.ival = nacl_ready_state_; } -bool Plugin::Init(int argc, char* argn[], char* argv[]) { - PLUGIN_PRINTF(("Plugin::Init (instance=%p)\n", static_cast<void*>(this))); +bool Plugin::EarlyInit(int argc, const char* argn[], const char* argv[]) { + PLUGIN_PRINTF(("Plugin::EarlyInit (instance=%p)\n", + static_cast<void*>(this))); #ifdef NACL_OSX // TODO(kochi): For crbug.com/102808, this is a stopgap solution for Lion @@ -563,10 +550,10 @@ NaClSubprocess* Plugin::LoadHelperNaClModule(nacl::DescWrapper* wrapper, } char* Plugin::LookupArgument(const char* key) { - char** keys = argn(); - for (int ii = 0, len = argc(); ii < len; ++ii) { + char** keys = argn_; + for (int ii = 0, len = argc_; ii < len; ++ii) { if (!strcmp(keys[ii], key)) { - return argv()[ii]; + return argv_[ii]; } } return NULL; @@ -632,9 +619,6 @@ Plugin* Plugin::New(PP_Instance pp_instance) { PLUGIN_PRINTF(("Plugin::New (pp_instance=%" NACL_PRId32 ")\n", pp_instance)); Plugin* plugin = new Plugin(pp_instance); PLUGIN_PRINTF(("Plugin::New (plugin=%p)\n", static_cast<void*>(plugin))); - if (plugin == NULL) { - return NULL; - } return plugin; } @@ -661,12 +645,7 @@ bool Plugin::Init(uint32_t argc, const char* argn[], const char* argv[]) { PLUGIN_PRINTF(("Plugin::Init (url_util_=%p)\n", static_cast<const void*>(url_util_))); - bool status = Plugin::Init( - static_cast<int>(argc), - // TODO(polina): Can we change the args on our end to be const to - // avoid these ugly casts? - const_cast<char**>(argn), - const_cast<char**>(argv)); + bool status = EarlyInit(static_cast<int>(argc), argn, argv); if (status) { // Look for the developer attribute; if it's present, enable 'dev' // interfaces. @@ -988,7 +967,7 @@ void Plugin::NexeDidCrash(int32_t pp_error) { PLUGIN_PRINTF(("Plugin::NexeDidCrash: error already reported;" " suppressing\n")); } else { - if (nacl_ready_state() == DONE) { + if (nacl_ready_state_ == DONE) { ReportDeadNexe(); } else { ErrorInfo error_info; @@ -1055,7 +1034,7 @@ void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) { void Plugin::ReportDeadNexe() { PLUGIN_PRINTF(("Plugin::ReportDeadNexe\n")); - if (nacl_ready_state() == DONE && !nexe_error_reported()) { // After loadEnd. + if (nacl_ready_state_ == DONE && !nexe_error_reported()) { // After loadEnd. int64_t crash_time = NaClGetTimeOfDayMicroseconds(); // Crashes will be more likely near startup, so use a medium histogram // instead of a large one. @@ -1199,11 +1178,10 @@ void Plugin::ProcessNaClManifest(const nacl::string& manifest_json) { if (manifest_->GetProgramURL(&program_url, &pnacl_options, &error_info)) { is_installed_ = GetUrlScheme(program_url) == SCHEME_CHROME_EXTENSION; - set_nacl_ready_state(LOADING); + nacl_ready_state_ = LOADING; // Inform JavaScript that we found a nexe URL to load. EnqueueProgressEvent(kProgressEventProgress); if (pnacl_options.translate()) { - CHECK(nacl_interface()->IsPnaclEnabled()); pp::CompletionCallback translate_callback = callback_factory_.NewCallback(&Plugin::BitcodeDidTranslate); // Will always call the callback on success or failure. @@ -1259,7 +1237,7 @@ void Plugin::RequestNaClManifest(const nacl::string& url) { set_manifest_base_url(nmf_resolved_url.AsString()); set_manifest_url(url); // Inform JavaScript that a load is starting. - set_nacl_ready_state(OPENED); + nacl_ready_state_ = OPENED; EnqueueProgressEvent(kProgressEventLoadStart); bool is_data_uri = GetUrlScheme(nmf_resolved_url.AsString()) == SCHEME_DATA; HistogramEnumerateManifestIsDataURI(static_cast<int>(is_data_uri)); @@ -1378,7 +1356,7 @@ void Plugin::ReportLoadSuccess(LengthComputable length_computable, uint64_t loaded_bytes, uint64_t total_bytes) { // Set the readyState attribute to indicate loaded. - set_nacl_ready_state(DONE); + nacl_ready_state_ = DONE; // Inform JavaScript that loading was successful and is complete. const nacl::string& url = nexe_downloader_.url_to_open(); EnqueueProgressEvent( @@ -1405,7 +1383,7 @@ void Plugin::ReportLoadError(const ErrorInfo& error_info) { } // Set the readyState attribute to indicate we need to start over. - set_nacl_ready_state(DONE); + nacl_ready_state_ = DONE; set_nexe_error_reported(true); // Report an error in lastError and on the JavaScript console. nacl::string message = nacl::string("NaCl module load failed: ") + @@ -1425,7 +1403,7 @@ void Plugin::ReportLoadError(const ErrorInfo& error_info) { void Plugin::ReportLoadAbort() { PLUGIN_PRINTF(("Plugin::ReportLoadAbort\n")); // Set the readyState attribute to indicate we need to start over. - set_nacl_ready_state(DONE); + nacl_ready_state_ = DONE; set_nexe_error_reported(true); // Report an error in lastError and on the JavaScript console. nacl::string error_string("NaCl module load failed: user aborted"); diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index 416ab5bf71..c1a93880af 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -22,10 +22,7 @@ #include "native_client/src/trusted/validator/nacl_file_info.h" #include "ppapi/c/private/ppb_nacl_private.h" -#include "ppapi/cpp/private/var_private.h" -// for pp::VarPrivate #include "ppapi/cpp/private/instance_private.h" -#include "ppapi/cpp/rect.h" #include "ppapi/cpp/url_loader.h" #include "ppapi/cpp/var.h" #include "ppapi/cpp/view.h" @@ -36,21 +33,14 @@ #include "ppapi/native_client/src/trusted/plugin/service_runtime.h" #include "ppapi/native_client/src/trusted/plugin/utility.h" -struct NaClSrpcChannel; - namespace nacl { class DescWrapper; class DescWrapperFactory; } // namespace nacl namespace pp { -class Find_Dev; -class MouseLock; -class Printing_Dev; -class Selection_Dev; class URLLoader; class URLUtil_Dev; -class Zoom_Dev; } namespace ppapi_proxy { @@ -178,13 +168,6 @@ class Plugin : public pp::InstancePrivate { // Report nexe death after load to JS and shut down the proxy. void ReportDeadNexe(); - // The embed/object tag argument list. - int argc() const { return argc_; } - char** argn() const { return argn_; } - char** argv() const { return argv_; } - - Plugin* plugin() const { return const_cast<Plugin*>(this); } - // URL resolution support. // plugin_base_url is the URL used for resolving relative URLs used in // src="...". @@ -218,10 +201,6 @@ class Plugin : public pp::InstancePrivate { // interaction with the page. DONE = 4 }; - ReadyState nacl_ready_state() const { return nacl_ready_state_; } - void set_nacl_ready_state(ReadyState nacl_ready_state) { - nacl_ready_state_ = nacl_ready_state; - } bool nexe_error_reported() const { return nexe_error_reported_; } void set_nexe_error_reported(bool val) { nexe_error_reported_ = val; @@ -311,7 +290,7 @@ class Plugin : public pp::InstancePrivate { // pointer to this object, not from base's Delete(). ~Plugin(); - bool Init(int argc, char* argn[], char* argv[]); + bool EarlyInit(int argc, const char* argn[], const char* argv[]); // Shuts down socket connection, service runtime, and receive thread, // in this order, for the main nacl subprocess. void ShutDownSubprocesses(); diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc index 26268bf7eb..860a67ebac 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc @@ -233,13 +233,11 @@ PnaclCoordinator* PnaclCoordinator::BitcodeToNative( reinterpret_cast<const void*>(coordinator->manifest_.get()), coordinator->off_the_record_)); - // First check that PNaCl is installed. - pp::CompletionCallback pnacl_installed_cb = - coordinator->callback_factory_.NewCallback( - &PnaclCoordinator::DidCheckPnaclInstalled); - plugin->nacl_interface()->EnsurePnaclInstalled( - plugin->pp_instance(), - pnacl_installed_cb.pp_completion_callback()); + // First start a network request for the pexe, to tickle the component + // updater's On-Demand resource throttler, and to get Last-Modified/ETag + // cache information. We can cancel the request later if there's + // a bitcode->nexe cache hit. + coordinator->OpenBitcodeStream(); return coordinator; } @@ -470,13 +468,45 @@ void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) { return; } - OpenBitcodeStream(); + // Okay, now that we've started the HTTP request for the pexe + // and we've ensured that the PNaCl compiler + metadata is installed, + // get the cache key from the response headers and from the + // compiler's version metadata. + nacl::string headers = streaming_downloader_->GetResponseHeaders(); + NaClHttpResponseHeaders parser; + parser.Parse(headers); + + temp_nexe_file_.reset(new TempFile(plugin_)); + pp::CompletionCallback cb = + callback_factory_.NewCallback(&PnaclCoordinator::NexeFdDidOpen); + int32_t nexe_fd_err = + plugin_->nacl_interface()->GetNexeFd( + plugin_->pp_instance(), + streaming_downloader_->url().c_str(), + // TODO(dschuff): Get this value from the pnacl json file after it + // rolls in from NaCl. + 1, + pnacl_options_.opt_level(), + parser.GetHeader("last-modified").c_str(), + parser.GetHeader("etag").c_str(), + PP_FromBool(parser.CacheControlNoStore()), + &is_cache_hit_, + temp_nexe_file_->existing_handle(), + cb.pp_completion_callback()); + if (nexe_fd_err < PP_OK_COMPLETIONPENDING) { + ReportPpapiError(ERROR_PNACL_CREATE_TEMP, nexe_fd_err, + nacl::string("Call to GetNexeFd failed")); + } } void PnaclCoordinator::OpenBitcodeStream() { // Now open the pexe stream. streaming_downloader_.reset(new FileDownloader()); streaming_downloader_->Initialize(plugin_); + // Mark the request as requesting a PNaCl bitcode file, + // so that component updater can detect this user action. + streaming_downloader_->set_request_headers( + "Accept: application/x-pnacl, */*"); // Even though we haven't started downloading, create the translation // thread object immediately. This ensures that any pieces of the file @@ -509,32 +539,14 @@ void PnaclCoordinator::BitcodeStreamDidOpen(int32_t pp_error) { return; } - // Get the cache key and try to open an existing entry. - nacl::string headers = streaming_downloader_->GetResponseHeaders(); - NaClHttpResponseHeaders parser; - parser.Parse(headers); - - temp_nexe_file_.reset(new TempFile(plugin_)); - pp::CompletionCallback cb = - callback_factory_.NewCallback(&PnaclCoordinator::NexeFdDidOpen); - int32_t nexe_fd_err = - plugin_->nacl_interface()->GetNexeFd( - plugin_->pp_instance(), - streaming_downloader_->url().c_str(), - // TODO(dschuff): Get this value from the pnacl json file after it - // rolls in from NaCl. - 1, - pnacl_options_.opt_level(), - parser.GetHeader("last-modified").c_str(), - parser.GetHeader("etag").c_str(), - PP_FromBool(parser.CacheControlNoStore()), - &is_cache_hit_, - temp_nexe_file_->existing_handle(), - cb.pp_completion_callback()); - if (nexe_fd_err < PP_OK_COMPLETIONPENDING) { - ReportPpapiError(ERROR_PNACL_CREATE_TEMP, nexe_fd_err, - nacl::string("Call to GetNexeFd failed")); - } + // Now that we've started the url request for the response headers and + // for tickling the component updater's On-Demand API, check that the + // compiler is present, or block until it is present or an error is hit. + pp::CompletionCallback pnacl_installed_cb = + callback_factory_.NewCallback(&PnaclCoordinator::DidCheckPnaclInstalled); + plugin_->nacl_interface()->EnsurePnaclInstalled( + plugin_->pp_instance(), + pnacl_installed_cb.pp_completion_callback()); } void PnaclCoordinator::NexeFdDidOpen(int32_t pp_error) { diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h index 97828646a5..4b65e9e618 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h +++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.h @@ -54,10 +54,10 @@ class TempFile; // (2) ld links the object code in obj_file_ and produces a nexe in nexe_file_. // // The coordinator proceeds through several states. They are -// LOAD_TRANSLATOR_BINARIES -// Complete when ResourcesDidLoad is invoked. // OPEN_BITCODE_STREAM // Complete when BitcodeStreamDidOpen is invoked +// LOAD_TRANSLATOR_BINARIES +// Complete when ResourcesDidLoad is invoked. // GET_NEXE_FD // Get an FD which contains the cached nexe, or is writeable for // translation output. Complete when NexeFdDidOpen is called. @@ -139,6 +139,12 @@ class PnaclCoordinator: public CallbackSource<FileStreamData> { const PnaclOptions& pnacl_options, const pp::CompletionCallback& translate_notify_callback); + // Invoke to issue a GET request for bitcode. + void OpenBitcodeStream(); + // Invoked when we've started an URL fetch for the pexe to check for + // caching metadata. + void BitcodeStreamDidOpen(int32_t pp_error); + // Callback for when we know PNaCl is installed. void DidCheckPnaclInstalled(int32_t pp_error); @@ -147,14 +153,6 @@ class PnaclCoordinator: public CallbackSource<FileStreamData> { // Callback for when llc and ld have been downloaded. void ResourcesDidLoad(int32_t pp_error); - - // Callbacks for temporary file related stages. - // They are invoked from ResourcesDidLoad and proceed in declaration order. - // Invoke to issue a GET request for bitcode. - void OpenBitcodeStream(); - // Invoked when we've started an URL fetch for the pexe to check for - // caching metadata. - void BitcodeStreamDidOpen(int32_t pp_error); // Invoked when we've gotten a temp FD for the nexe, either with the nexe // data, or a writeable fd to save to. void NexeFdDidOpen(int32_t pp_error); diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc index 2795786232..8f59f3a020 100644 --- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc @@ -337,7 +337,6 @@ void PluginReverseInterface::OpenManifestEntry_MainThreadContinuation( NaClLog(4, "OpenManifestEntry_MainThreadContinuation: " "pulling down and translating.\n"); - CHECK(plugin_->nacl_interface()->IsPnaclEnabled()); pp::CompletionCallback translate_callback = WeakRefNewCallback( anchor_, diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 9e3b477f65..d8ca859732 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -2523,9 +2523,9 @@ static void Pnacl_M31_PPB_ContentDecryptor_Private_DeliverFrame(PP_Instance inst iface->DeliverFrame(instance, decrypted_frame, decrypted_frame_info); } -static void Pnacl_M31_PPB_ContentDecryptor_Private_DeliverSamples(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info) { +static void Pnacl_M31_PPB_ContentDecryptor_Private_DeliverSamples(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedSampleInfo* decrypted_sample_info) { const struct PPB_ContentDecryptor_Private_0_7 *iface = Pnacl_WrapperInfo_PPB_ContentDecryptor_Private_0_7.real_iface; - iface->DeliverSamples(instance, audio_frames, decrypted_block_info); + iface->DeliverSamples(instance, audio_frames, decrypted_sample_info); } /* End wrapper methods for PPB_ContentDecryptor_Private_0_7 */ @@ -3093,11 +3093,6 @@ static PP_Bool Pnacl_M25_PPB_NaCl_Private_IsOffTheRecord(void) { return iface->IsOffTheRecord(); } -static PP_Bool Pnacl_M25_PPB_NaCl_Private_IsPnaclEnabled(void) { - const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; - return iface->IsPnaclEnabled(); -} - static PP_ExternalPluginResult Pnacl_M25_PPB_NaCl_Private_ReportNaClError(PP_Instance instance, PP_NaClError message_id) { const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface; return iface->ReportNaClError(instance, message_id); @@ -4800,7 +4795,7 @@ struct PPB_ContentDecryptor_Private_0_7 Pnacl_Wrappers_PPB_ContentDecryptor_Priv .DecoderDeinitializeDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M31_PPB_ContentDecryptor_Private_DecoderDeinitializeDone, .DecoderResetDone = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M31_PPB_ContentDecryptor_Private_DecoderResetDone, .DeliverFrame = (void (*)(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info))&Pnacl_M31_PPB_ContentDecryptor_Private_DeliverFrame, - .DeliverSamples = (void (*)(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedBlockInfo* decrypted_block_info))&Pnacl_M31_PPB_ContentDecryptor_Private_DeliverSamples + .DeliverSamples = (void (*)(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedSampleInfo* decrypted_sample_info))&Pnacl_M31_PPB_ContentDecryptor_Private_DeliverSamples }; struct PPB_Ext_CrxFileSystem_Private_0_1 Pnacl_Wrappers_PPB_Ext_CrxFileSystem_Private_0_1 = { @@ -4955,7 +4950,6 @@ struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = { .GetNexeFd = (int32_t (*)(PP_Instance instance, const char* pexe_url, uint32_t abi_version, uint32_t opt_level, const char* last_modified, const char* etag, PP_Bool has_no_store_header, PP_Bool* is_hit, PP_FileHandle* nexe_handle, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_GetNexeFd, .ReportTranslationFinished = (void (*)(PP_Instance instance, PP_Bool success))&Pnacl_M25_PPB_NaCl_Private_ReportTranslationFinished, .IsOffTheRecord = (PP_Bool (*)(void))&Pnacl_M25_PPB_NaCl_Private_IsOffTheRecord, - .IsPnaclEnabled = (PP_Bool (*)(void))&Pnacl_M25_PPB_NaCl_Private_IsPnaclEnabled, .ReportNaClError = (PP_ExternalPluginResult (*)(PP_Instance instance, PP_NaClError message_id))&Pnacl_M25_PPB_NaCl_Private_ReportNaClError, .OpenNaClExecutable = (PP_FileHandle (*)(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi))&Pnacl_M25_PPB_NaCl_Private_OpenNaClExecutable }; diff --git a/ppapi/proxy/audio_input_resource.cc b/ppapi/proxy/audio_input_resource.cc index 4a7afff1a2..7c29df5b74 100644 --- a/ppapi/proxy/audio_input_resource.cc +++ b/ppapi/proxy/audio_input_resource.cc @@ -8,7 +8,6 @@ #include "base/logging.h" #include "ipc/ipc_platform_file.h" #include "media/audio/audio_parameters.h" -#include "media/audio/shared_memory_util.h" #include "ppapi/c/pp_errors.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/resource_message_params.h" @@ -168,15 +167,9 @@ void AudioInputResource::OnPluginMsgOpenReply( params.TakeHandleOfTypeAtIndex(1, SerializedHandle::SHARED_MEMORY); CHECK(serialized_shared_memory_handle.IsHandleValid()); - // See the comment in pepper_audio_input_host.cc about how we must call - // TotalSharedMemorySizeInBytes to get the actual size of the buffer. Here, - // we must call PacketSizeInBytes to get back the size of the audio buffer, - // excluding the bytes that audio uses for book-keeping. - size_t shared_memory_size = media::PacketSizeInBytes( - serialized_shared_memory_handle.size()); - open_state_ = OPENED; - SetStreamInfo(serialized_shared_memory_handle.shmem(), shared_memory_size, + SetStreamInfo(serialized_shared_memory_handle.shmem(), + serialized_shared_memory_handle.size(), socket_handle); } else { capturing_ = false; diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc index b1eb450479..347d4ef891 100644 --- a/ppapi/proxy/file_io_resource.cc +++ b/ppapi/proxy/file_io_resource.cc @@ -138,21 +138,33 @@ int32_t FileIOResource::Query(PP_FileInfo* info, return PP_ERROR_FAILED; state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); - scoped_refptr<QueryOp> query_op(new QueryOp(file_handle_)); // If the callback is blocking, perform the task on the calling thread. if (callback->is_blocking()) { - int32_t result; + int32_t result = PP_ERROR_FAILED; + base::PlatformFileInfo file_info; + // The plugin could release its reference to this instance when we release + // the proxy lock below. + scoped_refptr<FileIOResource> protect(this); { // Release the proxy lock while making a potentially slow file call. ProxyAutoUnlock unlock; - result = query_op->DoWork(); + if (base::GetPlatformFileInfo(file_handle_->raw_handle(), &file_info)) + result = PP_OK; + } + if (result == PP_OK) { + // This writes the file info into the plugin's PP_FileInfo struct. + ppapi::PlatformFileInfoToPepperFileInfo(file_info, + file_system_type_, + info); } - return OnQueryComplete(query_op, info, result); + state_manager_.SetOperationFinished(); + return result; } // For the non-blocking case, post a task to the file thread and add a // completion task to write the result. + scoped_refptr<QueryOp> query_op(new QueryOp(file_handle_)); base::PostTaskAndReplyWithResult( PpapiGlobals::Get()->GetFileTaskRunner(), FROM_HERE, @@ -316,19 +328,28 @@ int32_t FileIOResource::ReadValidated(int64_t offset, state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_READ); bytes_to_read = std::min(bytes_to_read, kMaxReadSize); - scoped_refptr<ReadOp> read_op( - new ReadOp(file_handle_, offset, bytes_to_read)); if (callback->is_blocking()) { - int32_t result; - { + char* buffer = static_cast<char*>( + array_output.GetDataBuffer(array_output.user_data, bytes_to_read, 1)); + int32_t result = PP_ERROR_FAILED; + // The plugin could release its reference to this instance when we release + // the proxy lock below. + scoped_refptr<FileIOResource> protect(this); + if (buffer) { // Release the proxy lock while making a potentially slow file call. ProxyAutoUnlock unlock; - result = read_op->DoWork(); + result = base::ReadPlatformFile( + file_handle_->raw_handle(), offset, buffer, bytes_to_read); + if (result < 0) + result = PP_ERROR_FAILED; } - return OnReadComplete(read_op, array_output, result); + state_manager_.SetOperationFinished(); + return result; } // For the non-blocking case, post a task to the file thread. + scoped_refptr<ReadOp> read_op( + new ReadOp(file_handle_, offset, bytes_to_read)); base::PostTaskAndReplyWithResult( PpapiGlobals::Get()->GetFileTaskRunner(), FROM_HERE, diff --git a/ppapi/proxy/handle_converter.cc b/ppapi/proxy/handle_converter.cc index 534a8ae594..587585b53b 100644 --- a/ppapi/proxy/handle_converter.cc +++ b/ppapi/proxy/handle_converter.cc @@ -227,17 +227,14 @@ bool HandleConverter::ConvertNativeHandlesToPosix( // compatible with Windows IPC deserialization code; it is intended to be // passed to NaCl. #if defined(OS_WIN) - new_msg_ptr->reset( - new IPC::Message(msg.routing_id(), msg.type(), msg.priority())); + new_msg_ptr->reset(new IPC::Message(msg.routing_id(), msg.type())); #else // Even on POSIX, we have to rewrite messages to create channels, because // these contain a handle with an invalid (place holder) descriptor. The // message sending code sees this and doesn't pass the descriptor over // correctly. - if (msg.type() == PpapiMsg_CreateNaClChannel::ID) { - new_msg_ptr->reset( - new IPC::Message(msg.routing_id(), msg.type(), msg.priority())); - } + if (msg.type() == PpapiMsg_CreateNaClChannel::ID) + new_msg_ptr->reset(new IPC::Message(msg.routing_id(), msg.type())); #endif switch (msg.type()) { diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc index 9ea9d69377..063cafb336 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.cc +++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc @@ -213,6 +213,11 @@ void PpapiCommandBufferProxy::SignalQuery(uint32 query, NOTREACHED(); } +void PpapiCommandBufferProxy::SendManagedMemoryStats( + const gpu::ManagedMemoryStats& stats) { + NOTREACHED(); +} + bool PpapiCommandBufferProxy::SupportsGpuMemoryBuffer() { return false; } diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h index 430054dd9e..bca5190421 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.h +++ b/ppapi/proxy/ppapi_command_buffer_proxy.h @@ -61,6 +61,8 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy const base::Closure& callback) OVERRIDE; virtual void SignalQuery(uint32 query, const base::Closure& callback) OVERRIDE; + virtual void SendManagedMemoryStats(const gpu::ManagedMemoryStats& stats) + OVERRIDE; private: bool Send(IPC::Message* msg); diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc index 49ed0afb2d..58f5abc0d4 100644 --- a/ppapi/proxy/ppb_audio_proxy.cc +++ b/ppapi/proxy/ppb_audio_proxy.cc @@ -6,7 +6,6 @@ #include "base/compiler_specific.h" #include "base/threading/simple_thread.h" -#include "media/audio/shared_memory_util.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_audio.h" #include "ppapi/c/ppb_audio_config.h" @@ -262,15 +261,7 @@ void PPB_Audio_Proxy::AudioChannelConnected( // us, as long as the remote side always closes the handles it receives // (in OnMsgNotifyAudioStreamCreated), even in the failure case. SerializedHandle fd_wrapper(SerializedHandle::SOCKET, socket_handle); - - // Note that we must call TotalSharedMemorySizeInBytes because - // Audio allocates extra space in shared memory for book-keeping, so the - // actual size of the shared memory buffer is larger than audio_buffer_length. - // When sending to NaCl, NaClIPCAdapter expects this size to match the size - // of the full shared memory buffer. - SerializedHandle handle_wrapper( - shared_memory, - media::TotalSharedMemorySizeInBytes(audio_buffer_length)); + SerializedHandle handle_wrapper(shared_memory, audio_buffer_length); dispatcher()->Send(new PpapiMsg_PPBAudio_NotifyAudioStreamCreated( API_ID_PPB_AUDIO, resource, result_code, fd_wrapper, handle_wrapper)); } @@ -333,13 +324,8 @@ void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated( } else { EnterResourceNoLock<PPB_AudioConfig_API> config( static_cast<Audio*>(enter.object())->GetCurrentConfig(), true); - // See the comment above about how we must call - // TotalSharedMemorySizeInBytes to get the actual size of the buffer. Here, - // we must call PacketSizeInBytes to get back the size of the audio buffer, - // excluding the bytes that audio uses for book-keeping. static_cast<Audio*>(enter.object())->SetStreamInfo( - enter.resource()->pp_instance(), handle.shmem(), - media::PacketSizeInBytes(handle.size()), + enter.resource()->pp_instance(), handle.shmem(), handle.size(), IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), config.object()->GetSampleRate(), config.object()->GetSampleFrameCount()); diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index fdaa8c47d2..1997f89008 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -675,7 +675,7 @@ void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance, void PPB_Instance_Proxy::DeliverSamples( PP_Instance instance, PP_Resource decrypted_samples, - const PP_DecryptedBlockInfo* block_info) { + const PP_DecryptedSampleInfo* sample_info) { PP_Resource host_resource = 0; if (decrypted_samples != 0) { ResourceTracker* tracker = PpapiGlobals::Get()->GetResourceTracker(); @@ -689,8 +689,8 @@ void PPB_Instance_Proxy::DeliverSamples( host_resource = object->host_resource().host_resource(); } - std::string serialized_block_info; - if (!SerializeBlockInfo(*block_info, &serialized_block_info)) { + std::string serialized_sample_info; + if (!SerializeBlockInfo(*sample_info, &serialized_sample_info)) { NOTREACHED(); return; } @@ -699,7 +699,7 @@ void PPB_Instance_Proxy::DeliverSamples( new PpapiHostMsg_PPBInstance_DeliverSamples(API_ID_PPB_INSTANCE, instance, host_resource, - serialized_block_info)); + serialized_sample_info)); } #endif // !defined(OS_NACL) @@ -1165,16 +1165,16 @@ void PPB_Instance_Proxy::OnHostMsgDeliverFrame( void PPB_Instance_Proxy::OnHostMsgDeliverSamples( PP_Instance instance, PP_Resource audio_frames, - const std::string& serialized_block_info) { + const std::string& serialized_sample_info) { if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) return; - PP_DecryptedBlockInfo block_info; - if (!DeserializeBlockInfo(serialized_block_info, &block_info)) + PP_DecryptedSampleInfo sample_info; + if (!DeserializeBlockInfo(serialized_sample_info, &sample_info)) return; EnterInstanceNoLock enter(instance); if (enter.succeeded()) - enter.functions()->DeliverSamples(instance, audio_frames, &block_info); + enter.functions()->DeliverSamples(instance, audio_frames, &sample_info); } void PPB_Instance_Proxy::OnHostMsgSetCursor( diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h index a6516bc175..5aaa2d11a6 100644 --- a/ppapi/proxy/ppb_instance_proxy.h +++ b/ppapi/proxy/ppb_instance_proxy.h @@ -146,9 +146,10 @@ class PPB_Instance_Proxy : public InterfaceProxy, virtual void DeliverFrame(PP_Instance instance, PP_Resource decrypted_frame, const PP_DecryptedFrameInfo* frame_info) OVERRIDE; - virtual void DeliverSamples(PP_Instance instance, - PP_Resource audio_frames, - const PP_DecryptedBlockInfo* block_info) OVERRIDE; + virtual void DeliverSamples( + PP_Instance instance, + PP_Resource audio_frames, + const PP_DecryptedSampleInfo* sample_info) OVERRIDE; #endif // !defined(OS_NACL) static const ApiID kApiID = API_ID_PPB_INSTANCE; @@ -253,7 +254,7 @@ class PPB_Instance_Proxy : public InterfaceProxy, virtual void OnHostMsgDeliverSamples( PP_Instance instance, PP_Resource audio_frames, - const std::string& serialized_block_info); + const std::string& serialized_sample_info); #endif // !defined(OS_NACL) // Host -> Plugin message handlers. diff --git a/ppapi/shared_impl/ppb_audio_shared.cc b/ppapi/shared_impl/ppb_audio_shared.cc index 25d9011696..b81cd3b093 100644 --- a/ppapi/shared_impl/ppb_audio_shared.cc +++ b/ppapi/shared_impl/ppb_audio_shared.cc @@ -5,7 +5,6 @@ #include "ppapi/shared_impl/ppb_audio_shared.h" #include "base/logging.h" -#include "media/audio/shared_memory_util.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/ppb_audio_config_shared.h" #include "ppapi/shared_impl/proxy_lock.h" @@ -114,8 +113,7 @@ void PPB_Audio_Shared::SetStreamInfo( bytes_per_second_ = kAudioOutputChannels * (kBitsPerAudioOutputSample / 8) * sample_rate; - if (!shared_memory_->Map( - media::TotalSharedMemorySizeInBytes(shared_memory_size_))) { + if (!shared_memory_->Map(shared_memory_size_)) { PpapiGlobals::Get()->LogWithSource( instance, PP_LOGLEVEL_WARNING, @@ -203,13 +201,11 @@ void PPB_Audio_Shared::CallRun(void* self) { #endif void PPB_Audio_Shared::Run() { - int pending_data; - const int bytes_per_frame = - sizeof(*audio_bus_->channel(0)) * audio_bus_->channels(); - + int pending_data = 0; + uint32_t buffer_index = 0; while (sizeof(pending_data) == socket_->Receive(&pending_data, sizeof(pending_data)) && - pending_data != media::kPauseMark) { + pending_data >= 0) { PP_TimeDelta latency = static_cast<double>(pending_data) / bytes_per_second_; callback_.Run(client_buffer_.get(), client_buffer_size_bytes_, latency, @@ -220,14 +216,10 @@ void PPB_Audio_Shared::Run() { client_buffer_.get(), audio_bus_->frames(), kBitsPerAudioOutputSample / 8); - // Let the host know we are done. - // TODO(dalecurtis): Technically this is not the exact size. Due to channel - // padding for alignment, there may be more data available than this. We're - // relying on AudioSyncReader::Read() to parse this with that in mind. - // Rename these methods to Set/GetActualFrameCount(). - media::SetActualDataSizeInBytes( - shared_memory_.get(), shared_memory_size_, - audio_bus_->frames() * bytes_per_frame); + ++buffer_index; + size_t bytes_sent = socket_->Send(&buffer_index, sizeof(buffer_index)); + if (bytes_sent != sizeof(buffer_index)) + break; } } diff --git a/ppapi/shared_impl/ppb_image_data_shared.cc b/ppapi/shared_impl/ppb_image_data_shared.cc index 50751a0382..3900c92197 100644 --- a/ppapi/shared_impl/ppb_image_data_shared.cc +++ b/ppapi/shared_impl/ppb_image_data_shared.cc @@ -26,7 +26,12 @@ PP_ImageDataFormat PPB_ImageData_Shared::GetNativeImageDataFormat() { NOTIMPLEMENTED(); return PP_IMAGEDATAFORMAT_BGRA_PREMUL; #else - return PP_IMAGEDATAFORMAT_BGRA_PREMUL; + if (SK_B32_SHIFT == 0) + return PP_IMAGEDATAFORMAT_BGRA_PREMUL; + else if (SK_R32_SHIFT == 0) + return PP_IMAGEDATAFORMAT_RGBA_PREMUL; + else + return PP_IMAGEDATAFORMAT_BGRA_PREMUL; // Default to something on failure #endif } diff --git a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc index 7fe79e1284..a43d24dea6 100644 --- a/ppapi/thunk/ppb_content_decryptor_private_thunk.cc +++ b/ppapi/thunk/ppb_content_decryptor_private_thunk.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. // From private/ppb_content_decryptor_private.idl, -// modified Tue Sep 17 11:31:05 2013. +// modified Thu Oct 10 14:49:51 2013. #include "ppapi/c/pp_errors.h" #include "ppapi/c/private/ppb_content_decryptor_private.h" @@ -123,14 +123,14 @@ void DeliverFrame(PP_Instance instance, void DeliverSamples( PP_Instance instance, PP_Resource audio_frames, - const struct PP_DecryptedBlockInfo* decrypted_block_info) { + const struct PP_DecryptedSampleInfo* decrypted_sample_info) { VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()"; EnterInstance enter(instance); if (enter.failed()) return; enter.functions()->DeliverSamples(instance, audio_frames, - decrypted_block_info); + decrypted_sample_info); } const PPB_ContentDecryptor_Private_0_7 diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h index 0d424a5ed5..93eba9ca4f 100644 --- a/ppapi/thunk/ppb_instance_api.h +++ b/ppapi/thunk/ppb_instance_api.h @@ -173,7 +173,7 @@ class PPB_Instance_API { const PP_DecryptedFrameInfo* frame_info) = 0; virtual void DeliverSamples(PP_Instance instance, PP_Resource audio_frames, - const PP_DecryptedBlockInfo* block_info) = 0; + const PP_DecryptedSampleInfo* sample_info) = 0; // URLUtil. virtual PP_Var ResolveRelativeToDocument( |