summaryrefslogtreecommitdiff
path: root/chromium/ppapi/proxy
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-03-18 13:16:26 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-20 15:55:39 +0100
commit3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch)
tree92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/ppapi/proxy
parente90d7c4b152c56919d963987e2503f9909a666d2 (diff)
downloadqtwebengine-chromium-3f0f86b0caed75241fa71c95a5d73bc0164348c5.tar.gz
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies needed on Windows. Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42 Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu> Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/ppapi/proxy')
-rw-r--r--chromium/ppapi/proxy/audio_input_resource.cc11
-rw-r--r--chromium/ppapi/proxy/connection.h2
-rw-r--r--chromium/ppapi/proxy/device_enumeration_resource_helper_unittest.cc53
-rw-r--r--chromium/ppapi/proxy/file_chooser_resource_unittest.cc6
-rw-r--r--chromium/ppapi/proxy/file_io_resource.cc186
-rw-r--r--chromium/ppapi/proxy/file_io_resource.h59
-rw-r--r--chromium/ppapi/proxy/file_system_resource.cc35
-rw-r--r--chromium/ppapi/proxy/file_system_resource.h13
-rw-r--r--chromium/ppapi/proxy/flash_drm_resource.cc28
-rw-r--r--chromium/ppapi/proxy/flash_drm_resource.h8
-rw-r--r--chromium/ppapi/proxy/graphics_2d_resource.cc23
-rw-r--r--chromium/ppapi/proxy/graphics_2d_resource.h2
-rw-r--r--chromium/ppapi/proxy/handle_converter.cc285
-rw-r--r--chromium/ppapi/proxy/handle_converter.h62
-rw-r--r--chromium/ppapi/proxy/interface_list.cc39
-rw-r--r--chromium/ppapi/proxy/interface_list.h3
-rw-r--r--chromium/ppapi/proxy/isolated_file_system_private_resource.cc (renamed from chromium/ppapi/proxy/ext_crx_file_system_private_resource.cc)39
-rw-r--r--chromium/ppapi/proxy/isolated_file_system_private_resource.h (renamed from chromium/ppapi/proxy/ext_crx_file_system_private_resource.h)33
-rw-r--r--chromium/ppapi/proxy/nacl_message_scanner.cc298
-rw-r--r--chromium/ppapi/proxy/nacl_message_scanner.h62
-rw-r--r--chromium/ppapi/proxy/output_protection_resource.cc105
-rw-r--r--chromium/ppapi/proxy/output_protection_resource.h58
-rw-r--r--chromium/ppapi/proxy/pdf_resource.cc4
-rw-r--r--chromium/ppapi/proxy/pdf_resource.h1
-rw-r--r--chromium/ppapi/proxy/platform_verification_private_resource.cc29
-rw-r--r--chromium/ppapi/proxy/platform_verification_private_resource.h9
-rw-r--r--chromium/ppapi/proxy/plugin_dispatcher.cc39
-rw-r--r--chromium/ppapi/proxy/plugin_dispatcher.h17
-rw-r--r--chromium/ppapi/proxy/plugin_globals.cc11
-rw-r--r--chromium/ppapi/proxy/plugin_globals.h9
-rw-r--r--chromium/ppapi/proxy/plugin_main_nacl.cc30
-rw-r--r--chromium/ppapi/proxy/plugin_message_filter.cc51
-rw-r--r--chromium/ppapi/proxy/plugin_message_filter.h47
-rw-r--r--chromium/ppapi/proxy/plugin_resource.cc12
-rw-r--r--chromium/ppapi/proxy/plugin_resource.h37
-rw-r--r--chromium/ppapi/proxy/plugin_resource_var.cc2
-rw-r--r--chromium/ppapi/proxy/plugin_resource_var.h1
-rw-r--r--chromium/ppapi/proxy/plugin_var_tracker.cc66
-rw-r--r--chromium/ppapi/proxy/plugin_var_tracker.h5
-rw-r--r--chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc84
-rw-r--r--chromium/ppapi/proxy/ppapi_command_buffer_proxy.h63
-rw-r--r--chromium/ppapi/proxy/ppapi_messages.h140
-rw-r--r--chromium/ppapi/proxy/ppapi_param_traits.cc43
-rw-r--r--chromium/ppapi/proxy/ppapi_param_traits.h9
-rw-r--r--chromium/ppapi/proxy/ppb_audio_proxy.cc18
-rw-r--r--chromium/ppapi/proxy/ppb_graphics_3d_proxy.cc165
-rw-r--r--chromium/ppapi/proxy/ppb_graphics_3d_proxy.h10
-rw-r--r--chromium/ppapi/proxy/ppb_image_data_proxy.cc6
-rw-r--r--chromium/ppapi/proxy/ppb_instance_proxy.cc176
-rw-r--r--chromium/ppapi/proxy/ppb_instance_proxy.h65
-rw-r--r--chromium/ppapi/proxy/ppb_message_loop_proxy.cc4
-rw-r--r--chromium/ppapi/proxy/ppb_message_loop_proxy.h2
-rw-r--r--chromium/ppapi/proxy/ppb_testing_proxy.cc23
-rw-r--r--chromium/ppapi/proxy/ppb_testing_proxy.h6
-rw-r--r--chromium/ppapi/proxy/ppb_var_deprecated_proxy.cc20
-rw-r--r--chromium/ppapi/proxy/ppb_var_deprecated_proxy.h5
-rw-r--r--chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.cc103
-rw-r--r--chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.h20
-rw-r--r--chromium/ppapi/proxy/printing_resource_unittest.cc9
-rw-r--r--chromium/ppapi/proxy/raw_var_data.cc89
-rw-r--r--chromium/ppapi/proxy/raw_var_data.h41
-rw-r--r--chromium/ppapi/proxy/raw_var_data_unittest.cc13
-rw-r--r--chromium/ppapi/proxy/resource_creation_proxy.cc8
-rw-r--r--chromium/ppapi/proxy/resource_creation_proxy.h2
-rw-r--r--chromium/ppapi/proxy/resource_reply_thread_registrar.cc71
-rw-r--r--chromium/ppapi/proxy/resource_reply_thread_registrar.h70
-rw-r--r--chromium/ppapi/proxy/talk_resource_unittest.cc16
-rw-r--r--chromium/ppapi/proxy/tcp_socket_resource_base.cc27
-rw-r--r--chromium/ppapi/proxy/udp_socket_resource_base.cc12
-rw-r--r--chromium/ppapi/proxy/websocket_resource.cc6
-rw-r--r--chromium/ppapi/proxy/websocket_resource_unittest.cc32
71 files changed, 1853 insertions, 1285 deletions
diff --git a/chromium/ppapi/proxy/audio_input_resource.cc b/chromium/ppapi/proxy/audio_input_resource.cc
index 4a7afff1a2c..7c29df5b744 100644
--- a/chromium/ppapi/proxy/audio_input_resource.cc
+++ b/chromium/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/chromium/ppapi/proxy/connection.h b/chromium/ppapi/proxy/connection.h
index 13cbbc6fcf4..cc8255cd7ad 100644
--- a/chromium/ppapi/proxy/connection.h
+++ b/chromium/ppapi/proxy/connection.h
@@ -40,7 +40,7 @@ struct Connection {
bool in_process;
// We need to use a routing ID when a plugin is in-process, and messages are
// sent back from the browser to the renderer. This is so that messages are
- // routed to the proper RenderViewImpl.
+ // routed to the proper RenderFrameImpl.
int browser_sender_routing_id;
};
diff --git a/chromium/ppapi/proxy/device_enumeration_resource_helper_unittest.cc b/chromium/ppapi/proxy/device_enumeration_resource_helper_unittest.cc
index 56c09d7966c..bbf70527065 100644
--- a/chromium/ppapi/proxy/device_enumeration_resource_helper_unittest.cc
+++ b/chromium/ppapi/proxy/device_enumeration_resource_helper_unittest.cc
@@ -7,6 +7,7 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/connection.h"
#include "ppapi/proxy/device_enumeration_resource_helper.h"
+#include "ppapi/proxy/plugin_message_filter.h"
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/plugin_var_tracker.h"
@@ -258,10 +259,9 @@ TEST_F(DeviceEnumerationResourceHelperTest, EnumerateDevices) {
{
ProxyAutoUnlock unlock;
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply(data))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_EnumerateDevicesReply(data));
}
EXPECT_TRUE(callback.called());
EXPECT_EQ(PP_OK, callback.result());
@@ -304,11 +304,10 @@ TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) {
{
ProxyAutoUnlock unlock;
// Synthesize a response with no device.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
- callback_id, data))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+ callback_id, data));
}
EXPECT_TRUE(helper.called() && helper.same_as_expected());
@@ -327,11 +326,10 @@ TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) {
{
ProxyAutoUnlock unlock;
// Synthesize a response with some devices.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
- callback_id, data))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+ callback_id, data));
}
EXPECT_TRUE(helper.called() && helper.same_as_expected());
@@ -357,11 +355,10 @@ TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) {
{
ProxyAutoUnlock unlock;
// |helper2| should receive the result while |helper| shouldn't.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
- callback_id2, data))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+ callback_id2, data));
}
EXPECT_TRUE(helper2.called() && helper2.same_as_expected());
EXPECT_FALSE(helper.called());
@@ -372,11 +369,10 @@ TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) {
ProxyAutoUnlock unlock;
// Even if a message with |callback_id| arrives. |helper| shouldn't receive
// the result.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
- callback_id, data))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+ callback_id, data));
}
EXPECT_FALSE(helper2.called());
EXPECT_FALSE(helper.called());
@@ -396,11 +392,10 @@ TEST_F(DeviceEnumerationResourceHelperTest, MonitorDeviceChange) {
{
ProxyAutoUnlock unlock;
// |helper2| shouldn't receive any result any more.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
- callback_id2, data))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params,
+ PpapiPluginMsg_DeviceEnumeration_NotifyDeviceChange(
+ callback_id2, data));
}
EXPECT_FALSE(helper2.called());
}
diff --git a/chromium/ppapi/proxy/file_chooser_resource_unittest.cc b/chromium/ppapi/proxy/file_chooser_resource_unittest.cc
index 4ba5bd9da88..a97b9c9f4a2 100644
--- a/chromium/ppapi/proxy/file_chooser_resource_unittest.cc
+++ b/chromium/ppapi/proxy/file_chooser_resource_unittest.cc
@@ -8,6 +8,7 @@
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/proxy/file_chooser_resource.h"
#include "ppapi/proxy/locking_resource_releaser.h"
+#include "ppapi/proxy/plugin_message_filter.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
#include "ppapi/shared_impl/proxy_lock.h"
@@ -101,9 +102,8 @@ TEST_F(FileChooserResourceTest, Show) {
create_info.browser_pending_host_resource_id = 12;
create_info.renderer_pending_host_resource_id = 15;
create_info_array.push_back(create_info);
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(reply_params,
- PpapiPluginMsg_FileChooser_ShowReply(create_info_array))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params, PpapiPluginMsg_FileChooser_ShowReply(create_info_array));
// Should have populated our vector.
ASSERT_EQ(1u, dest.size());
diff --git a/chromium/ppapi/proxy/file_io_resource.cc b/chromium/ppapi/proxy/file_io_resource.cc
index fc53fb05243..ad0718709c3 100644
--- a/chromium/ppapi/proxy/file_io_resource.cc
+++ b/chromium/ppapi/proxy/file_io_resource.cc
@@ -10,23 +10,28 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/array_writer.h"
+#include "ppapi/shared_impl/file_ref_create_info.h"
+#include "ppapi/shared_impl/file_system_util.h"
#include "ppapi/shared_impl/file_type_conversion.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/proxy_lock.h"
#include "ppapi/shared_impl/resource_tracker.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_file_ref_api.h"
+#include "ppapi/thunk/ppb_file_system_api.h"
using ppapi::thunk::EnterResourceNoLock;
using ppapi::thunk::PPB_FileIO_API;
using ppapi::thunk::PPB_FileRef_API;
+using ppapi::thunk::PPB_FileSystem_API;
namespace {
// We must allocate a buffer sized according to the request of the plugin. To
-// reduce the chance of out-of-memory errors, we cap the read size to 32MB.
-// This is OK since the API specifies that it may perform a partial read.
-static const int32_t kMaxReadSize = 32 * 1024 * 1024; // 32MB
+// reduce the chance of out-of-memory errors, we cap the read and write size to
+// 32MB. This is OK since the API specifies that it may perform a partial read
+// or write.
+static const int32_t kMaxReadWriteSize = 32 * 1024 * 1024; // 32MB
// An adapter to let Read() share the same implementation with ReadToArray().
void* DummyGetDataBuffer(void* user_data, uint32_t count, uint32_t size) {
@@ -43,24 +48,26 @@ void DoClose(base::PlatformFile file) {
namespace ppapi {
namespace proxy {
-FileIOResource::QueryOp::QueryOp(PP_FileHandle file_handle)
+FileIOResource::QueryOp::QueryOp(scoped_refptr<FileHandleHolder> file_handle)
: file_handle_(file_handle) {
+ DCHECK(file_handle_);
}
FileIOResource::QueryOp::~QueryOp() {
}
int32_t FileIOResource::QueryOp::DoWork() {
- return base::GetPlatformFileInfo(file_handle_, &file_info_) ?
+ return base::GetPlatformFileInfo(file_handle_->raw_handle(), &file_info_) ?
PP_OK : PP_ERROR_FAILED;
}
-FileIOResource::ReadOp::ReadOp(PP_FileHandle file_handle,
+FileIOResource::ReadOp::ReadOp(scoped_refptr<FileHandleHolder> file_handle,
int64_t offset,
int32_t bytes_to_read)
: file_handle_(file_handle),
offset_(offset),
bytes_to_read_(bytes_to_read) {
+ DCHECK(file_handle_);
}
FileIOResource::ReadOp::~ReadOp() {
@@ -70,18 +77,18 @@ int32_t FileIOResource::ReadOp::DoWork() {
DCHECK(!buffer_.get());
buffer_.reset(new char[bytes_to_read_]);
return base::ReadPlatformFile(
- file_handle_, offset_, buffer_.get(), bytes_to_read_);
+ file_handle_->raw_handle(), offset_, buffer_.get(), bytes_to_read_);
}
FileIOResource::FileIOResource(Connection connection, PP_Instance instance)
: PluginResource(connection, instance),
- file_handle_(base::kInvalidPlatformFileValue),
- file_system_type_(PP_FILESYSTEMTYPE_INVALID) {
- SendCreate(RENDERER, PpapiHostMsg_FileIO_Create());
+ file_system_type_(PP_FILESYSTEMTYPE_INVALID),
+ called_close_(false) {
+ SendCreate(BROWSER, PpapiHostMsg_FileIO_Create());
}
FileIOResource::~FileIOResource() {
- CloseFileHandle();
+ Close();
}
PPB_FileIO_API* FileIOResource::AsPPB_FileIO_API() {
@@ -91,31 +98,38 @@ PPB_FileIO_API* FileIOResource::AsPPB_FileIO_API() {
int32_t FileIOResource::Open(PP_Resource file_ref,
int32_t open_flags,
scoped_refptr<TrackedCallback> callback) {
- EnterResourceNoLock<PPB_FileRef_API> enter(file_ref, true);
- if (enter.failed())
+ EnterResourceNoLock<PPB_FileRef_API> enter_file_ref(file_ref, true);
+ if (enter_file_ref.failed())
return PP_ERROR_BADRESOURCE;
- PPB_FileRef_API* file_ref_api = enter.object();
- PP_FileSystemType type = file_ref_api->GetFileSystemType();
- if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT &&
- type != PP_FILESYSTEMTYPE_LOCALTEMPORARY &&
- type != PP_FILESYSTEMTYPE_EXTERNAL &&
- type != PP_FILESYSTEMTYPE_ISOLATED) {
+ PPB_FileRef_API* file_ref_api = enter_file_ref.object();
+ const FileRefCreateInfo& create_info = file_ref_api->GetCreateInfo();
+ if (!FileSystemTypeIsValid(create_info.file_system_type)) {
NOTREACHED();
return PP_ERROR_FAILED;
}
- file_system_type_ = type;
-
int32_t rv = state_manager_.CheckOperationState(
FileIOStateManager::OPERATION_EXCLUSIVE, false);
if (rv != PP_OK)
return rv;
+ file_system_type_ = create_info.file_system_type;
+
+ if (create_info.file_system_plugin_resource) {
+ EnterResourceNoLock<PPB_FileSystem_API> enter_file_system(
+ create_info.file_system_plugin_resource, true);
+ if (enter_file_system.failed())
+ return PP_ERROR_FAILED;
+ // Take a reference on the FileSystem resource. The FileIO host uses the
+ // FileSystem host for running tasks and checking quota.
+ file_system_resource_ = enter_file_system.resource();
+ }
+
// Take a reference on the FileRef resource while we're opening the file; we
// don't want the plugin destroying it during the Open operation.
- file_ref_ = enter.resource();
+ file_ref_ = enter_file_ref.resource();
- Call<PpapiPluginMsg_FileIO_OpenReply>(RENDERER,
+ Call<PpapiPluginMsg_FileIO_OpenReply>(BROWSER,
PpapiHostMsg_FileIO_Open(
file_ref,
open_flags),
@@ -134,27 +148,39 @@ int32_t FileIOResource::Query(PP_FileInfo* info,
return rv;
if (!info)
return PP_ERROR_BADARGUMENT;
- if (file_handle_ == base::kInvalidPlatformFileValue)
+ if (!FileHandleHolder::IsValid(file_handle_))
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;
}
- return OnQueryComplete(query_op, info, result);
+ if (result == PP_OK) {
+ // This writes the file info into the plugin's PP_FileInfo struct.
+ ppapi::PlatformFileInfoToPepperFileInfo(file_info,
+ file_system_type_,
+ info);
+ }
+ 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(pp_instance()),
+ PpapiGlobals::Get()->GetFileTaskRunner(),
FROM_HERE,
Bind(&FileIOResource::QueryOp::DoWork, query_op),
RunWhileLocked(Bind(&TrackedCallback::Run, callback)));
@@ -172,7 +198,7 @@ int32_t FileIOResource::Touch(PP_Time last_access_time,
if (rv != PP_OK)
return rv;
- Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
+ Call<PpapiPluginMsg_FileIO_GeneralReply>(BROWSER,
PpapiHostMsg_FileIO_Touch(last_access_time, last_modified_time),
base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this,
callback));
@@ -221,7 +247,8 @@ int32_t FileIOResource::Write(int64_t offset,
// TODO(brettw) it would be nice to use a shared memory buffer for large
// writes rather than having to copy to a string (which will involve a number
// of extra copies to serialize over IPC).
- Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
+ bytes_to_write = std::min(bytes_to_write, kMaxReadWriteSize);
+ Call<PpapiPluginMsg_FileIO_GeneralReply>(BROWSER,
PpapiHostMsg_FileIO_Write(offset, std::string(buffer, bytes_to_write)),
base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this,
callback));
@@ -237,7 +264,7 @@ int32_t FileIOResource::SetLength(int64_t length,
if (rv != PP_OK)
return rv;
- Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
+ Call<PpapiPluginMsg_FileIO_GeneralReply>(BROWSER,
PpapiHostMsg_FileIO_SetLength(length),
base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this,
callback));
@@ -252,7 +279,7 @@ int32_t FileIOResource::Flush(scoped_refptr<TrackedCallback> callback) {
if (rv != PP_OK)
return rv;
- Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
+ Call<PpapiPluginMsg_FileIO_GeneralReply>(BROWSER,
PpapiHostMsg_FileIO_Flush(),
base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this,
callback));
@@ -262,16 +289,14 @@ int32_t FileIOResource::Flush(scoped_refptr<TrackedCallback> callback) {
}
void FileIOResource::Close() {
- CloseFileHandle();
- Post(RENDERER, PpapiHostMsg_FileIO_Close());
-}
+ if (called_close_)
+ return;
+
+ called_close_ = true;
+ if (file_handle_)
+ file_handle_ = NULL;
-int32_t FileIOResource::GetOSFileDescriptor() {
- int32_t file_descriptor;
- // Only available when running in process.
- SyncCall<PpapiPluginMsg_FileIO_GetOSFileDescriptorReply>(
- RENDERER, PpapiHostMsg_FileIO_GetOSFileDescriptor(), &file_descriptor);
- return file_descriptor;
+ Post(BROWSER, PpapiHostMsg_FileIO_Close());
}
int32_t FileIOResource::RequestOSFileHandle(
@@ -282,7 +307,7 @@ int32_t FileIOResource::RequestOSFileHandle(
if (rv != PP_OK)
return rv;
- Call<PpapiPluginMsg_FileIO_RequestOSFileHandleReply>(RENDERER,
+ Call<PpapiPluginMsg_FileIO_RequestOSFileHandleReply>(BROWSER,
PpapiHostMsg_FileIO_RequestOSFileHandle(),
base::Bind(&FileIOResource::OnPluginMsgRequestOSFileHandleComplete, this,
callback, handle));
@@ -291,25 +316,23 @@ int32_t FileIOResource::RequestOSFileHandle(
return PP_OK_COMPLETIONPENDING;
}
-int32_t FileIOResource::WillWrite(int64_t offset,
- int32_t bytes_to_write,
- scoped_refptr<TrackedCallback> callback) {
- Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
- PpapiHostMsg_FileIO_WillWrite(offset, bytes_to_write),
- base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this, callback));
-
- state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
- return PP_OK_COMPLETIONPENDING;
+FileIOResource::FileHandleHolder::FileHandleHolder(PP_FileHandle file_handle)
+ : raw_handle_(file_handle) {
}
-int32_t FileIOResource::WillSetLength(int64_t length,
- scoped_refptr<TrackedCallback> callback) {
- Call<PpapiPluginMsg_FileIO_GeneralReply>(RENDERER,
- PpapiHostMsg_FileIO_WillSetLength(length),
- base::Bind(&FileIOResource::OnPluginMsgGeneralComplete, this, callback));
+// static
+bool FileIOResource::FileHandleHolder::IsValid(
+ const scoped_refptr<FileIOResource::FileHandleHolder>& handle) {
+ return handle && (handle->raw_handle() != base::kInvalidPlatformFileValue);
+}
- state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
- return PP_OK_COMPLETIONPENDING;
+FileIOResource::FileHandleHolder::~FileHandleHolder() {
+ if (raw_handle_ != base::kInvalidPlatformFileValue) {
+ base::TaskRunner* file_task_runner =
+ PpapiGlobals::Get()->GetFileTaskRunner();
+ file_task_runner->PostTask(FROM_HERE,
+ base::Bind(&DoClose, raw_handle_));
+ }
}
int32_t FileIOResource::ReadValidated(int64_t offset,
@@ -318,27 +341,36 @@ int32_t FileIOResource::ReadValidated(int64_t offset,
scoped_refptr<TrackedCallback> callback) {
if (bytes_to_read < 0)
return PP_ERROR_FAILED;
- if (file_handle_ == base::kInvalidPlatformFileValue)
+ if (!FileHandleHolder::IsValid(file_handle_))
return PP_ERROR_FAILED;
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));
+ bytes_to_read = std::min(bytes_to_read, kMaxReadWriteSize);
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(pp_instance()),
+ PpapiGlobals::Get()->GetFileTaskRunner(),
FROM_HERE,
Bind(&FileIOResource::ReadOp::DoWork, read_op),
RunWhileLocked(Bind(&TrackedCallback::Run, callback)));
@@ -348,18 +380,6 @@ int32_t FileIOResource::ReadValidated(int64_t offset,
return PP_OK_COMPLETIONPENDING;
}
-void FileIOResource::CloseFileHandle() {
- if (file_handle_ != base::kInvalidPlatformFileValue) {
- // Close our local fd on the file thread.
- base::TaskRunner* file_task_runner =
- PpapiGlobals::Get()->GetFileTaskRunner(pp_instance());
- file_task_runner->PostTask(FROM_HERE,
- base::Bind(&DoClose, file_handle_));
-
- file_handle_ = base::kInvalidPlatformFileValue;
- }
-}
-
int32_t FileIOResource::OnQueryComplete(scoped_refptr<QueryOp> query_op,
PP_FileInfo* info,
int32_t result) {
@@ -422,8 +442,10 @@ void FileIOResource::OnPluginMsgOpenFileComplete(
int32_t result = params.result();
IPC::PlatformFileForTransit transit_file;
- if ((result == PP_OK) && params.TakeFileHandleAtIndex(0, &transit_file))
- file_handle_ = IPC::PlatformFileForTransitToPlatformFile(transit_file);
+ if ((result == PP_OK) && params.TakeFileHandleAtIndex(0, &transit_file)) {
+ file_handle_ = new FileHandleHolder(
+ IPC::PlatformFileForTransitToPlatformFile(transit_file));
+ }
// End this operation now, so the user's callback can execute another FileIO
// operation, assuming there are no other pending operations.
state_manager_.SetOperationFinished();
diff --git a/chromium/ppapi/proxy/file_io_resource.h b/chromium/ppapi/proxy/file_io_resource.h
index 26c4abb9488..bfdf24fb602 100644
--- a/chromium/ppapi/proxy/file_io_resource.h
+++ b/chromium/ppapi/proxy/file_io_resource.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "ppapi/c/private/pp_file_handle.h"
#include "ppapi/proxy/connection.h"
@@ -14,6 +15,7 @@
#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/shared_impl/file_io_state_manager.h"
#include "ppapi/shared_impl/resource.h"
+#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/thunk/ppb_file_io_api.h"
namespace ppapi {
@@ -57,22 +59,48 @@ class PPAPI_PROXY_EXPORT FileIOResource
scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual void Close() OVERRIDE;
- virtual int32_t GetOSFileDescriptor() OVERRIDE;
virtual int32_t RequestOSFileHandle(
PP_FileHandle* handle,
scoped_refptr<TrackedCallback> callback) OVERRIDE;
- virtual int32_t WillWrite(int64_t offset,
- int32_t bytes_to_write,
- scoped_refptr<TrackedCallback> callback) OVERRIDE;
- virtual int32_t WillSetLength(
- int64_t length,
- scoped_refptr<TrackedCallback> callback) OVERRIDE;
private:
+ // FileHandleHolder is used to guarantee that file operations will have a
+ // valid FD to operate on, even if they're in a different thread.
+ // If instead we just passed the raw FD, the FD could be closed before the
+ // file operation has a chance to run. It could interact with an invalid FD,
+ // or worse, the FD value could be reused if another file is opened quickly
+ // (POSIX is required to provide the lowest available value when opening a
+ // file). This could result in strange problems such as writing data to the
+ // wrong file.
+ //
+ // Operations that run on a background thread should hold one of these to
+ // ensure they have a valid file descriptor. The file handle is only closed
+ // when the last reference to the FileHandleHolder is removed, so we are
+ // guaranteed to operate on the correct file descriptor. It *is* still
+ // possible that the FileIOResource will be destroyed and "Abort" callbacks
+ // just before the operation does its task (e.g., Reading). In that case, we
+ // might for example Read from a file even though the FileIO has been
+ // destroyed and the plugin's callback got a PP_ERROR_ABORTED result. In the
+ // case of a write, we could write some data to the file despite the plugin
+ // receiving a PP_ERROR_ABORTED instead of a successful result.
+ class FileHandleHolder : public base::RefCountedThreadSafe<FileHandleHolder> {
+ public:
+ explicit FileHandleHolder(PP_FileHandle file_handle_);
+ PP_FileHandle raw_handle() {
+ return raw_handle_;
+ }
+ static bool IsValid(
+ const scoped_refptr<FileIOResource::FileHandleHolder>& handle);
+ private:
+ friend class base::RefCountedThreadSafe<FileHandleHolder>;
+ ~FileHandleHolder();
+ PP_FileHandle raw_handle_;
+ };
+
// Class to perform file query operations across multiple threads.
class QueryOp : public base::RefCountedThreadSafe<QueryOp> {
public:
- explicit QueryOp(PP_FileHandle file_handle);
+ explicit QueryOp(scoped_refptr<FileHandleHolder> file_handle);
// Queries the file. Called on the file thread (non-blocking) or the plugin
// thread (blocking). This should not be called when we hold the proxy lock.
@@ -84,14 +112,16 @@ class PPAPI_PROXY_EXPORT FileIOResource
friend class base::RefCountedThreadSafe<QueryOp>;
~QueryOp();
- PP_FileHandle file_handle_;
+ scoped_refptr<FileHandleHolder> file_handle_;
base::PlatformFileInfo file_info_;
};
// Class to perform file read operations across multiple threads.
class ReadOp : public base::RefCountedThreadSafe<ReadOp> {
public:
- ReadOp(PP_FileHandle file_handle, int64_t offset, int32_t bytes_to_read);
+ ReadOp(scoped_refptr<FileHandleHolder> file_handle,
+ int64_t offset,
+ int32_t bytes_to_read);
// Reads the file. Called on the file thread (non-blocking) or the plugin
// thread (blocking). This should not be called when we hold the proxy lock.
@@ -103,7 +133,7 @@ class PPAPI_PROXY_EXPORT FileIOResource
friend class base::RefCountedThreadSafe<ReadOp>;
~ReadOp();
- PP_FileHandle file_handle_;
+ scoped_refptr<FileHandleHolder> file_handle_;
int64_t offset_;
int32_t bytes_to_read_;
scoped_ptr<char[]> buffer_;
@@ -114,9 +144,6 @@ class PPAPI_PROXY_EXPORT FileIOResource
const PP_ArrayOutput& array_output,
scoped_refptr<TrackedCallback> callback);
- void CloseFileHandle();
-
-
// Completion tasks for file operations that are done in the plugin.
int32_t OnQueryComplete(scoped_refptr<QueryOp> query_op,
PP_FileInfo* info,
@@ -135,8 +162,10 @@ class PPAPI_PROXY_EXPORT FileIOResource
PP_FileHandle* output_handle,
const ResourceMessageReplyParams& params);
- PP_FileHandle file_handle_;
+ scoped_refptr<FileHandleHolder> file_handle_;
PP_FileSystemType file_system_type_;
+ scoped_refptr<Resource> file_system_resource_;
+ bool called_close_;
FileIOStateManager state_manager_;
scoped_refptr<Resource> file_ref_;
diff --git a/chromium/ppapi/proxy/file_system_resource.cc b/chromium/ppapi/proxy/file_system_resource.cc
index bab771929ac..df8c3907751 100644
--- a/chromium/ppapi/proxy/file_system_resource.cc
+++ b/chromium/ppapi/proxy/file_system_resource.cc
@@ -21,14 +21,28 @@ FileSystemResource::FileSystemResource(Connection connection,
: PluginResource(connection, instance),
type_(type),
called_open_(false),
- callback_count_(0) {
+ callback_count_(0),
+ callback_result_(PP_OK) {
DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID);
- // TODO(teravest): Temporarily create hosts in both the browser and renderer
- // while we move file related hosts to the browser.
SendCreate(RENDERER, PpapiHostMsg_FileSystem_Create(type_));
SendCreate(BROWSER, PpapiHostMsg_FileSystem_Create(type_));
}
+FileSystemResource::FileSystemResource(Connection connection,
+ PP_Instance instance,
+ int pending_renderer_id,
+ int pending_browser_id,
+ PP_FileSystemType type)
+ : PluginResource(connection, instance),
+ type_(type),
+ called_open_(true),
+ callback_count_(0),
+ callback_result_(PP_OK) {
+ DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID);
+ AttachToPendingHost(RENDERER, pending_renderer_id);
+ AttachToPendingHost(BROWSER, pending_browser_id);
+}
+
FileSystemResource::~FileSystemResource() {
}
@@ -62,6 +76,7 @@ PP_FileSystemType FileSystemResource::GetType() {
int32_t FileSystemResource::InitIsolatedFileSystem(
const std::string& fsid,
+ PP_IsolatedFileSystemType_Private type,
const base::Callback<void(int32_t)>& callback) {
// This call is mutually exclusive with Open() above, so we can reuse the
// called_open state.
@@ -71,12 +86,12 @@ int32_t FileSystemResource::InitIsolatedFileSystem(
called_open_ = true;
Call<PpapiPluginMsg_FileSystem_InitIsolatedFileSystemReply>(RENDERER,
- PpapiHostMsg_FileSystem_InitIsolatedFileSystem(fsid),
+ PpapiHostMsg_FileSystem_InitIsolatedFileSystem(fsid, type),
base::Bind(&FileSystemResource::InitIsolatedFileSystemComplete,
this,
callback));
Call<PpapiPluginMsg_FileSystem_InitIsolatedFileSystemReply>(BROWSER,
- PpapiHostMsg_FileSystem_InitIsolatedFileSystem(fsid),
+ PpapiHostMsg_FileSystem_InitIsolatedFileSystem(fsid, type),
base::Bind(&FileSystemResource::InitIsolatedFileSystemComplete,
this,
callback));
@@ -87,18 +102,24 @@ void FileSystemResource::OpenComplete(
scoped_refptr<TrackedCallback> callback,
const ResourceMessageReplyParams& params) {
++callback_count_;
+ // Prioritize worse result since only one status can be returned.
+ if (params.result() != PP_OK)
+ callback_result_ = params.result();
// Received callback from browser and renderer.
if (callback_count_ == 2)
- callback->Run(params.result());
+ callback->Run(callback_result_);
}
void FileSystemResource::InitIsolatedFileSystemComplete(
const base::Callback<void(int32_t)>& callback,
const ResourceMessageReplyParams& params) {
++callback_count_;
+ // Prioritize worse result since only one status can be returned.
+ if (params.result() != PP_OK)
+ callback_result_ = params.result();
// Received callback from browser and renderer.
if (callback_count_ == 2)
- callback.Run(params.result());
+ callback.Run(callback_result_);
}
} // namespace proxy
diff --git a/chromium/ppapi/proxy/file_system_resource.h b/chromium/ppapi/proxy/file_system_resource.h
index 74677f724ed..9029583c819 100644
--- a/chromium/ppapi/proxy/file_system_resource.h
+++ b/chromium/ppapi/proxy/file_system_resource.h
@@ -9,6 +9,7 @@
#include "base/memory/ref_counted.h"
#include "ppapi/c/pp_file_info.h"
+#include "ppapi/c/private/ppb_isolated_file_system_private.h"
#include "ppapi/proxy/connection.h"
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
@@ -25,9 +26,19 @@ class PPAPI_PROXY_EXPORT FileSystemResource
: public PluginResource,
public NON_EXPORTED_BASE(thunk::PPB_FileSystem_API) {
public:
+ // Creates a new FileSystemResource. The resource must be subsequently opened
+ // via Open() before use.
FileSystemResource(Connection connection,
PP_Instance instance,
PP_FileSystemType type);
+ // Creates a FileSystemResource, attached to an existing pending host
+ // resource. The |pending_renderer_id| and |pending_browser_id| must be
+ // already-opened file systems.
+ FileSystemResource(Connection connection,
+ PP_Instance instance,
+ int pending_renderer_id,
+ int pending_browser_id,
+ PP_FileSystemType type);
virtual ~FileSystemResource();
// Resource overrides.
@@ -39,6 +50,7 @@ class PPAPI_PROXY_EXPORT FileSystemResource
virtual PP_FileSystemType GetType() OVERRIDE;
int32_t InitIsolatedFileSystem(const std::string& fsid,
+ PP_IsolatedFileSystemType_Private type,
const base::Callback<void(int32_t)>& callback);
private:
// Called when the host has responded to our open request.
@@ -53,6 +65,7 @@ class PPAPI_PROXY_EXPORT FileSystemResource
PP_FileSystemType type_;
bool called_open_;
uint32_t callback_count_;
+ int32_t callback_result_;
DISALLOW_COPY_AND_ASSIGN(FileSystemResource);
};
diff --git a/chromium/ppapi/proxy/flash_drm_resource.cc b/chromium/ppapi/proxy/flash_drm_resource.cc
index 889aa72b457..8c80c5912b1 100644
--- a/chromium/ppapi/proxy/flash_drm_resource.cc
+++ b/chromium/ppapi/proxy/flash_drm_resource.cc
@@ -71,6 +71,22 @@ int32_t FlashDRMResource::GetVoucherFile(
return PP_OK_COMPLETIONPENDING;
}
+int32_t FlashDRMResource::MonitorIsExternal(
+ PP_Bool* is_external,
+ scoped_refptr<TrackedCallback> callback) {
+ if (!is_external)
+ return PP_ERROR_BADARGUMENT;
+
+ *is_external = PP_FALSE;
+
+ Call<PpapiPluginMsg_FlashDRM_MonitorIsExternalReply>(
+ BROWSER,
+ PpapiHostMsg_FlashDRM_MonitorIsExternal(),
+ base::Bind(&FlashDRMResource::OnPluginMsgMonitorIsExternalReply, this,
+ is_external, callback));
+ return PP_OK_COMPLETIONPENDING;
+}
+
void FlashDRMResource::OnPluginMsgGetDeviceIDReply(
PP_Var* dest,
scoped_refptr<TrackedCallback> callback,
@@ -99,5 +115,17 @@ void FlashDRMResource::OnPluginMsgGetVoucherFileReply(
}
}
+void FlashDRMResource::OnPluginMsgMonitorIsExternalReply(
+ PP_Bool* dest,
+ scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params,
+ PP_Bool is_external) {
+ if (TrackedCallback::IsPending(callback)) {
+ if (params.result() == PP_OK)
+ *dest = is_external;
+ callback->Run(params.result());
+ }
+}
+
} // namespace proxy
} // namespace ppapi
diff --git a/chromium/ppapi/proxy/flash_drm_resource.h b/chromium/ppapi/proxy/flash_drm_resource.h
index 9a4b31c941d..dd2b599c1c2 100644
--- a/chromium/ppapi/proxy/flash_drm_resource.h
+++ b/chromium/ppapi/proxy/flash_drm_resource.h
@@ -35,6 +35,9 @@ class FlashDRMResource
virtual int32_t GetVoucherFile(
PP_Resource* file_ref,
scoped_refptr<TrackedCallback> callback) OVERRIDE;
+ virtual int32_t MonitorIsExternal(
+ PP_Bool* is_external,
+ scoped_refptr<TrackedCallback> callback) OVERRIDE;
private:
void OnPluginMsgGetDeviceIDReply(PP_Var* dest,
@@ -45,6 +48,11 @@ class FlashDRMResource
scoped_refptr<TrackedCallback> callback,
const ResourceMessageReplyParams& params,
const FileRefCreateInfo& file_info);
+ void OnPluginMsgMonitorIsExternalReply(
+ PP_Bool* dest,
+ scoped_refptr<TrackedCallback> callback,
+ const ResourceMessageReplyParams& params,
+ PP_Bool is_external);
DISALLOW_COPY_AND_ASSIGN(FlashDRMResource);
};
diff --git a/chromium/ppapi/proxy/graphics_2d_resource.cc b/chromium/ppapi/proxy/graphics_2d_resource.cc
index 3bad2e4e13c..f545364f1e7 100644
--- a/chromium/ppapi/proxy/graphics_2d_resource.cc
+++ b/chromium/ppapi/proxy/graphics_2d_resource.cc
@@ -11,6 +11,7 @@
#include "ppapi/c/pp_size.h"
#include "ppapi/c/ppb_graphics_2d.h"
#include "ppapi/proxy/dispatch_reply_message.h"
+#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/resource_tracker.h"
@@ -111,6 +112,15 @@ float Graphics2DResource::GetScale() {
return scale_;
}
+void Graphics2DResource::SetOffset(const PP_Point* offset) {
+ Post(RENDERER, PpapiHostMsg_Graphics2D_SetOffset(*offset));
+}
+
+void Graphics2DResource::SetResizeMode(
+ PP_Graphics2D_Dev_ResizeMode resize_mode) {
+ Post(RENDERER, PpapiHostMsg_Graphics2D_SetResizeMode(resize_mode));
+}
+
int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) {
// If host is not even created, return failure immediately. This can happen
// when failed to initialize (in constructor).
@@ -121,9 +131,20 @@ int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) {
return PP_ERROR_INPROGRESS; // Can't have >1 flush pending.
current_flush_callback_ = callback;
+ // Send the current view data with the Flush() message. This allows the
+ // renderer to know what the plugin's view of the renderer is at the time
+ // Flush was called.
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
+ pp_instance());
+ ppapi::ViewData view_data;
+ if (dispatcher) {
+ InstanceData* data = dispatcher->GetInstanceData(pp_instance());
+ if (data)
+ view_data = data->view;
+ }
Call<PpapiPluginMsg_Graphics2D_FlushAck>(
RENDERER,
- PpapiHostMsg_Graphics2D_Flush(),
+ PpapiHostMsg_Graphics2D_Flush(view_data),
base::Bind(&Graphics2DResource::OnPluginMsgFlushACK, this));
return PP_OK_COMPLETIONPENDING;
}
diff --git a/chromium/ppapi/proxy/graphics_2d_resource.h b/chromium/ppapi/proxy/graphics_2d_resource.h
index b7ec30c710d..93d182b65a5 100644
--- a/chromium/ppapi/proxy/graphics_2d_resource.h
+++ b/chromium/ppapi/proxy/graphics_2d_resource.h
@@ -40,6 +40,8 @@ class PPAPI_PROXY_EXPORT Graphics2DResource
virtual void ReplaceContents(PP_Resource image_data) OVERRIDE;
virtual PP_Bool SetScale(float scale) OVERRIDE;
virtual float GetScale() OVERRIDE;
+ virtual void SetOffset(const PP_Point* offset) OVERRIDE;
+ virtual void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) OVERRIDE;
virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual bool ReadImageData(PP_Resource image,
const PP_Point* top_left) OVERRIDE;
diff --git a/chromium/ppapi/proxy/handle_converter.cc b/chromium/ppapi/proxy/handle_converter.cc
deleted file mode 100644
index 534a8ae5945..00000000000
--- a/chromium/ppapi/proxy/handle_converter.cc
+++ /dev/null
@@ -1,285 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/proxy/handle_converter.h"
-
-#include <vector>
-#include "base/bind.h"
-#include "ipc/ipc_message.h"
-#include "ipc/ipc_message_macros.h"
-#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/resource_message_params.h"
-#include "ppapi/proxy/serialized_handle.h"
-#include "ppapi/proxy/serialized_var.h"
-
-class NaClDescImcShm;
-
-namespace IPC {
-class Message;
-}
-
-namespace {
-
-void WriteHandle(int handle_index,
- const ppapi::proxy::SerializedHandle& handle,
- IPC::Message* message) {
- ppapi::proxy::SerializedHandle::WriteHeader(handle.header(), message);
-
- // Now write the handle itself in POSIX style.
- message->WriteBool(true); // valid == true
- message->WriteInt(handle_index);
-}
-
-typedef std::vector<ppapi::proxy::SerializedHandle> Handles;
-
-// We define overloads for catching SerializedHandles so that we can share
-// them correctly to the untrusted side.
-// See ConvertHandlesImpl for how these get used.
-void ConvertHandlesInParam(const ppapi::proxy::SerializedHandle& handle,
- Handles* handles,
- IPC::Message* msg,
- int* handle_index) {
- handles->push_back(handle);
- if (msg)
- WriteHandle((*handle_index)++, handle, msg);
-}
-
-void HandleWriter(int* handle_index,
- IPC::Message* m,
- const ppapi::proxy::SerializedHandle& handle) {
- WriteHandle((*handle_index)++, handle, m);
-}
-
-void ConvertHandlesInParam(const ppapi::proxy::SerializedVar& var,
- Handles* handles,
- IPC::Message* msg,
- int* handle_index) {
- std::vector<ppapi::proxy::SerializedHandle*> var_handles = var.GetHandles();
- if (var_handles.empty())
- return;
-
- for (size_t i = 0; i < var_handles.size(); ++i)
- handles->push_back(*var_handles[i]);
- if (msg)
- var.WriteDataToMessage(msg, base::Bind(&HandleWriter, handle_index));
-}
-
-// For PpapiMsg_ResourceReply and the reply to PpapiHostMsg_ResourceSyncCall,
-// the handles are carried inside the ResourceMessageReplyParams.
-// NOTE: We only translate handles from host->NaCl. The only kind of
-// ResourceMessageParams that travels this direction is
-// ResourceMessageReplyParams, so that's the only one we need to handle.
-void ConvertHandlesInParam(
- const ppapi::proxy::ResourceMessageReplyParams& params,
- Handles* handles,
- IPC::Message* msg,
- int* handle_index) {
- // First, if we need to rewrite the message parameters, write everything
- // before the handles (there's nothing after the handles).
- if (msg) {
- params.WriteReplyHeader(msg);
- // IPC writes the vector length as an int before the contents of the
- // vector.
- msg->WriteInt(static_cast<int>(params.handles().size()));
- }
- for (Handles::const_iterator iter = params.handles().begin();
- iter != params.handles().end();
- ++iter) {
- // ConvertHandle will write each handle to |msg|, if necessary.
- ConvertHandlesInParam(*iter, handles, msg, handle_index);
- }
- // Tell ResourceMessageReplyParams that we have taken the handles, so it
- // shouldn't close them. The NaCl runtime will take ownership of them.
- params.ConsumeHandles();
-}
-
-// This overload is to catch all types other than SerializedHandle or
-// ResourceMessageReplyParams. On Windows, |msg| will be a valid pointer, and we
-// must write |param| to it.
-template <class T>
-void ConvertHandlesInParam(const T& param,
- Handles* /* handles */,
- IPC::Message* msg,
- int* /* handle_index */) {
- // It's not a handle, so just write to the output message, if necessary.
- if (msg)
- IPC::WriteParam(msg, param);
-}
-
-// These just break apart the given tuple and run ConvertHandle over each param.
-// The idea is to extract any handles in the tuple, while writing all data to
-// msg (if msg is valid). The msg will only be valid on Windows, where we need
-// to re-write all of the message parameters, writing the handles in POSIX style
-// for NaCl.
-template <class A>
-void ConvertHandlesImpl(const Tuple1<A>& t1, Handles* handles,
- IPC::Message* msg) {
- int handle_index = 0;
- ConvertHandlesInParam(t1.a, handles, msg, &handle_index);
-}
-template <class A, class B>
-void ConvertHandlesImpl(const Tuple2<A, B>& t1, Handles* handles,
- IPC::Message* msg) {
- int handle_index = 0;
- ConvertHandlesInParam(t1.a, handles, msg, &handle_index);
- ConvertHandlesInParam(t1.b, handles, msg, &handle_index);
-}
-template <class A, class B, class C>
-void ConvertHandlesImpl(const Tuple3<A, B, C>& t1, Handles* handles,
- IPC::Message* msg) {
- int handle_index = 0;
- ConvertHandlesInParam(t1.a, handles, msg, &handle_index);
- ConvertHandlesInParam(t1.b, handles, msg, &handle_index);
- ConvertHandlesInParam(t1.c, handles, msg, &handle_index);
-}
-template <class A, class B, class C, class D>
-void ConvertHandlesImpl(const Tuple4<A, B, C, D>& t1, Handles* handles,
- IPC::Message* msg) {
- int handle_index = 0;
- ConvertHandlesInParam(t1.a, handles, msg, &handle_index);
- ConvertHandlesInParam(t1.b, handles, msg, &handle_index);
- ConvertHandlesInParam(t1.c, handles, msg, &handle_index);
- ConvertHandlesInParam(t1.d, handles, msg, &handle_index);
-}
-
-template <class MessageType>
-class HandleConverterImpl {
- public:
- explicit HandleConverterImpl(const IPC::Message* msg)
- : msg_(static_cast<const MessageType*>(msg)) {
- }
- bool ConvertMessage(Handles* handles, IPC::Message* out_msg) {
- typename TupleTypes<typename MessageType::Schema::Param>::ValueTuple params;
- if (!MessageType::Read(msg_, &params))
- return false;
- ConvertHandlesImpl(params, handles, out_msg);
- return true;
- }
-
- bool ConvertReply(Handles* handles, IPC::SyncMessage* out_msg) {
- typename TupleTypes<typename MessageType::Schema::ReplyParam>::ValueTuple
- params;
- if (!MessageType::ReadReplyParam(msg_, &params))
- return false;
- // If we need to rewrite the message (i.e., on Windows), we need to make
- // sure we write the message id first.
- if (out_msg) {
- out_msg->set_reply();
- int id = IPC::SyncMessage::GetMessageId(*msg_);
- out_msg->WriteInt(id);
- }
- ConvertHandlesImpl(params, handles, out_msg);
- return true;
- }
- // TODO(dmichael): Add ConvertSyncMessage for outgoing sync messages, if we
- // ever pass handles in one of those.
-
- private:
- const MessageType* msg_;
-};
-
-} // namespace
-
-#define CASE_FOR_MESSAGE(MESSAGE_TYPE) \
- case MESSAGE_TYPE::ID: { \
- HandleConverterImpl<MESSAGE_TYPE> extractor(&msg); \
- if (!extractor.ConvertMessage(handles, new_msg_ptr->get())) \
- return false; \
- break; \
- }
-#define CASE_FOR_REPLY(MESSAGE_TYPE) \
- case MESSAGE_TYPE::ID: { \
- HandleConverterImpl<MESSAGE_TYPE> extractor(&msg); \
- if (!extractor.ConvertReply( \
- handles, \
- static_cast<IPC::SyncMessage*>(new_msg_ptr->get()))) \
- return false; \
- break; \
- }
-
-namespace ppapi {
-namespace proxy {
-
-class SerializedHandle;
-
-HandleConverter::HandleConverter() {
-}
-
-bool HandleConverter::ConvertNativeHandlesToPosix(
- const IPC::Message& msg,
- std::vector<SerializedHandle>* handles,
- scoped_ptr<IPC::Message>* new_msg_ptr) {
- DCHECK(handles);
- DCHECK(new_msg_ptr);
- DCHECK(!new_msg_ptr->get());
-
- // In Windows, we need to re-write the contents of the message. This is
- // because in Windows IPC code, native HANDLE values are serialized in the
- // body of the message.
- //
- // In POSIX, we only serialize an index in to a FileDescriptorSet, and the
- // actual file descriptors are sent out-of-band. So on Windows, to make a
- // message that's compatible with Windows, we need to write a new message that
- // has simple indices in the message body instead of the HANDLEs.
- //
- // NOTE: This means on Windows, new_msg_ptr's serialized contents are not
- // 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()));
-#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()));
- }
-#endif
-
- switch (msg.type()) {
- CASE_FOR_MESSAGE(PpapiMsg_CreateNaClChannel)
- CASE_FOR_MESSAGE(PpapiMsg_PPBAudio_NotifyAudioStreamCreated)
- CASE_FOR_MESSAGE(PpapiMsg_PPPMessaging_HandleMessage)
- CASE_FOR_MESSAGE(PpapiPluginMsg_ResourceReply)
- case IPC_REPLY_ID: {
- int id = IPC::SyncMessage::GetMessageId(msg);
- PendingSyncMsgMap::iterator iter(pending_sync_msgs_.find(id));
- if (iter == pending_sync_msgs_.end()) {
- NOTREACHED();
- return false;
- }
- uint32_t type = iter->second;
- pending_sync_msgs_.erase(iter);
- switch (type) {
- CASE_FOR_REPLY(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer)
- CASE_FOR_REPLY(PpapiHostMsg_PPBImageData_CreateSimple)
- CASE_FOR_REPLY(PpapiHostMsg_ResourceSyncCall)
- CASE_FOR_REPLY(PpapiHostMsg_SharedMemory_CreateSharedMemory)
- default:
- // Do nothing for messages we don't know.
- break;
- }
- break;
- }
- default:
- // Do nothing for messages we don't know.
- break;
- }
- return true;
-}
-
-void HandleConverter::RegisterSyncMessageForReply(const IPC::Message& msg) {
- DCHECK(msg.is_sync());
-
- int msg_id = IPC::SyncMessage::GetMessageId(msg);
- DCHECK(pending_sync_msgs_.find(msg_id) == pending_sync_msgs_.end());
-
- pending_sync_msgs_[msg_id] = msg.type();
-}
-
-} // namespace proxy
-} // namespace ppapi
diff --git a/chromium/ppapi/proxy/handle_converter.h b/chromium/ppapi/proxy/handle_converter.h
deleted file mode 100644
index 456ee8db71c..00000000000
--- a/chromium/ppapi/proxy/handle_converter.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_PROXY_HANDLE_CONVERTER_H_
-#define PPAPI_PROXY_HANDLE_CONVERTER_H_
-
-#include <map>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "ppapi/proxy/ppapi_proxy_export.h"
-
-namespace IPC {
-class Message;
-}
-
-namespace ppapi {
-namespace proxy {
-
-class SerializedHandle;
-
-class PPAPI_PROXY_EXPORT HandleConverter {
- public:
- HandleConverter();
-
- // Convert the native handles in |msg| to NaCl style.
- // In some cases (e.g., Windows), we need to re-write the contents of the
- // message; in those cases, |new_msg_ptr| will be set to the new message.
- // If |msg| is already in a good form for NaCl, |new_msg_ptr| is left NULL.
- // See the explanation in the body of the method.
- //
- // In either case, all the handles in |msg| are extracted into |handles| so
- // that they can be converted to NaClDesc handles.
- // See chrome/nacl/nacl_ipc_adapter.cc for where this gets used.
- bool ConvertNativeHandlesToPosix(const IPC::Message& msg,
- std::vector<SerializedHandle>* handles,
- scoped_ptr<IPC::Message>* new_msg_ptr);
-
- // This method informs HandleConverter that a sync message is being sent so
- // that it can associate reply messages with their type.
- //
- // Users of HandleConverter must call this when they send a synchronous
- // message, otherwise HandleConverter won't be able to convert handles in
- // replies.
- void RegisterSyncMessageForReply(const IPC::Message& msg);
-
- private:
- // When we send a synchronous message (from untrusted to trusted), we store
- // its type here, so that later we can associate the reply with its type
- // and potentially translate handles in the message.
- typedef std::map<int, uint32> PendingSyncMsgMap;
- PendingSyncMsgMap pending_sync_msgs_;
-
- DISALLOW_COPY_AND_ASSIGN(HandleConverter);
-};
-
-} // namespace proxy
-} // namespace ppapi
-
-#endif // PPAPI_PROXY_HANDLE_CONVERTER_H_
diff --git a/chromium/ppapi/proxy/interface_list.cc b/chromium/ppapi/proxy/interface_list.cc
index 9c810a350ce..8b05f7ace99 100644
--- a/chromium/ppapi/proxy/interface_list.cc
+++ b/chromium/ppapi/proxy/interface_list.cc
@@ -6,6 +6,7 @@
#include "base/lazy_instance.h"
#include "base/memory/singleton.h"
+#include "ppapi/c/dev/ppb_alarms_dev.h"
#include "ppapi/c/dev/ppb_audio_input_dev.h"
#include "ppapi/c/dev/ppb_buffer_dev.h"
#include "ppapi/c/dev/ppb_char_set_dev.h"
@@ -21,15 +22,14 @@
#include "ppapi/c/dev/ppb_opengles2ext_dev.h"
#include "ppapi/c/dev/ppb_printing_dev.h"
#include "ppapi/c/dev/ppb_resource_array_dev.h"
-#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/dev/ppb_text_input_dev.h"
#include "ppapi/c/dev/ppb_trace_event_dev.h"
#include "ppapi/c/dev/ppb_truetype_font_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
+#include "ppapi/c/dev/ppb_var_resource_dev.h"
#include "ppapi/c/dev/ppb_video_capture_dev.h"
#include "ppapi/c/dev/ppb_view_dev.h"
-#include "ppapi/c/extensions/dev/ppb_ext_alarms_dev.h"
#include "ppapi/c/extensions/dev/ppb_ext_socket_dev.h"
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/ppb_audio.h"
@@ -80,12 +80,15 @@
#include "ppapi/c/private/ppb_flash_message_loop.h"
#include "ppapi/c/private/ppb_flash_print.h"
#include "ppapi/c/private/ppb_host_resolver_private.h"
+#include "ppapi/c/private/ppb_isolated_file_system_private.h"
#include "ppapi/c/private/ppb_net_address_private.h"
+#include "ppapi/c/private/ppb_output_protection_private.h"
#include "ppapi/c/private/ppb_pdf.h"
#include "ppapi/c/private/ppb_platform_verification_private.h"
#include "ppapi/c/private/ppb_talk_private.h"
#include "ppapi/c/private/ppb_tcp_server_socket_private.h"
#include "ppapi/c/private/ppb_tcp_socket_private.h"
+#include "ppapi/c/private/ppb_testing_private.h"
#include "ppapi/c/private/ppb_udp_socket_private.h"
#include "ppapi/c/private/ppb_video_destination_private.h"
#include "ppapi/c/private/ppb_video_source_private.h"
@@ -95,7 +98,6 @@
#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
#include "ppapi/c/trusted/ppb_char_set_trusted.h"
#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
-#include "ppapi/c/trusted/ppb_file_io_trusted.h"
#include "ppapi/c/trusted/ppb_url_loader_trusted.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/proxy/ppb_audio_proxy.h"
@@ -163,6 +165,7 @@ InterfaceProxy* ProxyFactory(Dispatcher* dispatcher) {
}
base::LazyInstance<PpapiPermissions> g_process_global_permissions;
+base::LazyInstance<bool> g_supports_dev_channel;
} // namespace
@@ -187,7 +190,6 @@ InterfaceList::InterfaceList() {
#include "ppapi/thunk/interfaces_ppb_private_no_permissions.h"
#include "ppapi/thunk/interfaces_ppb_public_stable.h"
}
-
{
Permission current_required_permission = PERMISSION_DEV;
#include "ppapi/thunk/interfaces_ppb_public_dev.h"
@@ -203,6 +205,8 @@ InterfaceList::InterfaceList() {
#endif // !defined(OS_NACL)
}
+ // TODO(teravest): Add dev channel interfaces here.
+
#undef PROXIED_API
#undef PROXIED_IFACE
@@ -246,8 +250,14 @@ InterfaceList::InterfaceList() {
// PPB (browser) interfaces.
// Do not add more stuff here, they should be added to interface_list*.h
// TODO(brettw) remove these.
- AddPPB(PPB_Instance_Proxy::GetInfoPrivate(), PERMISSION_PRIVATE);
- AddPPB(PPB_Var_Deprecated_Proxy::GetInfo(), PERMISSION_DEV);
+ AddProxy(API_ID_PPB_INSTANCE_PRIVATE, &ProxyFactory<PPB_Instance_Proxy>);
+ AddPPB(PPB_INSTANCE_PRIVATE_INTERFACE_0_1, API_ID_PPB_INSTANCE_PRIVATE,
+ thunk::GetPPB_Instance_Private_0_1_Thunk(),
+ PERMISSION_PRIVATE);
+
+ AddProxy(API_ID_PPB_VAR_DEPRECATED, &ProxyFactory<PPB_Var_Deprecated_Proxy>);
+ AddPPB(PPB_VAR_DEPRECATED_INTERFACE, API_ID_PPB_VAR_DEPRECATED,
+ PPB_Var_Deprecated_Proxy::GetProxyInterface(), PERMISSION_DEV);
// TODO(tomfinegan): Figure out where to put these once we refactor things
// to load the PPP interface struct from the PPB interface.
@@ -257,7 +267,9 @@ InterfaceList::InterfaceList() {
API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
PPP_ContentDecryptor_Private_Proxy::GetProxyInterface());
#endif
- AddPPB(PPB_Testing_Proxy::GetInfo(), PERMISSION_TESTING);
+ AddProxy(API_ID_PPB_TESTING, &ProxyFactory<PPB_Testing_Proxy>);
+ AddPPB(PPB_TESTING_PRIVATE_INTERFACE, API_ID_PPB_TESTING,
+ PPB_Testing_Proxy::GetProxyInterface(), PERMISSION_TESTING);
// PPP (plugin) interfaces.
// TODO(brettw) move these to interface_list*.h
@@ -300,6 +312,12 @@ void InterfaceList::SetProcessGlobalPermissions(
g_process_global_permissions.Get() = permissions;
}
+// static
+void InterfaceList::SetSupportsDevChannel(
+ bool supports_dev_channel) {
+ g_supports_dev_channel.Get() = supports_dev_channel;
+}
+
ApiID InterfaceList::GetIDForPPBInterface(const std::string& name) const {
NameToInterfaceInfoMap::const_iterator found =
name_to_browser_info_.find(name);
@@ -330,6 +348,8 @@ const void* InterfaceList::GetInterfaceForPPB(const std::string& name) const {
if (found == name_to_browser_info_.end())
return NULL;
+ // Dev channel checking goes here.
+
if (g_process_global_permissions.Get().HasPermission(
found->second.required_permission))
return found->second.iface;
@@ -375,11 +395,6 @@ void InterfaceList::AddPPP(const char* name,
name_to_plugin_info_[name] = InterfaceInfo(id, iface, PERMISSION_NONE);
}
-void InterfaceList::AddPPB(const InterfaceProxy::Info* info, Permission perm) {
- AddProxy(info->id, info->create_proxy);
- AddPPB(info->name, info->id, info->interface_ptr, perm);
-}
-
void InterfaceList::AddPPP(const InterfaceProxy::Info* info) {
AddProxy(info->id, info->create_proxy);
AddPPP(info->name, info->id, info->interface_ptr);
diff --git a/chromium/ppapi/proxy/interface_list.h b/chromium/ppapi/proxy/interface_list.h
index 9ef91dcc1f9..78064170d1c 100644
--- a/chromium/ppapi/proxy/interface_list.h
+++ b/chromium/ppapi/proxy/interface_list.h
@@ -35,6 +35,8 @@ class InterfaceList {
// using to keep honest plugins honest.
static PPAPI_PROXY_EXPORT void SetProcessGlobalPermissions(
const PpapiPermissions& permissions);
+ static PPAPI_PROXY_EXPORT void SetSupportsDevChannel(
+ bool supports_dev_channel);
// Looks up the ID for the given interface name. Returns API_ID_NONE if
// the interface string is not found.
@@ -85,7 +87,6 @@ class InterfaceList {
// Old-style add functions. These should be removed when the rest of the
// proxies are converted over to using the new system.
- void AddPPB(const InterfaceProxy::Info* info, Permission perm);
void AddPPP(const InterfaceProxy::Info* info);
PpapiPermissions permissions_;
diff --git a/chromium/ppapi/proxy/ext_crx_file_system_private_resource.cc b/chromium/ppapi/proxy/isolated_file_system_private_resource.cc
index be4c3f7bbd5..756bdb7bd6c 100644
--- a/chromium/ppapi/proxy/ext_crx_file_system_private_resource.cc
+++ b/chromium/ppapi/proxy/isolated_file_system_private_resource.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ppapi/proxy/ext_crx_file_system_private_resource.h"
+#include "ppapi/proxy/isolated_file_system_private_resource.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_file_info.h"
#include "ppapi/proxy/file_system_resource.h"
@@ -24,40 +25,37 @@ void RunTrackedCallback(scoped_refptr<TrackedCallback> callback,
}
} // namespace
-ExtCrxFileSystemPrivateResource::ExtCrxFileSystemPrivateResource(
+IsolatedFileSystemPrivateResource::IsolatedFileSystemPrivateResource(
Connection connection, PP_Instance instance)
- : PluginResource(connection, instance), called_open_(false) {
- SendCreate(BROWSER, PpapiHostMsg_Ext_CrxFileSystem_Create());
+ : PluginResource(connection, instance) {
+ SendCreate(BROWSER, PpapiHostMsg_IsolatedFileSystem_Create());
}
-ExtCrxFileSystemPrivateResource::~ExtCrxFileSystemPrivateResource() {
+IsolatedFileSystemPrivateResource::~IsolatedFileSystemPrivateResource() {
}
-thunk::PPB_Ext_CrxFileSystem_Private_API*
-ExtCrxFileSystemPrivateResource::AsPPB_Ext_CrxFileSystem_Private_API() {
+thunk::PPB_IsolatedFileSystem_Private_API*
+IsolatedFileSystemPrivateResource::AsPPB_IsolatedFileSystem_Private_API() {
return this;
}
-int32_t ExtCrxFileSystemPrivateResource::Open(
+int32_t IsolatedFileSystemPrivateResource::Open(
PP_Instance /* unused */,
+ PP_IsolatedFileSystemType_Private type,
PP_Resource* file_system_resource,
scoped_refptr<TrackedCallback> callback) {
- if (called_open_)
- return PP_ERROR_FAILED;
- called_open_ = true;
-
if (!file_system_resource)
return PP_ERROR_BADARGUMENT;
- Call<PpapiPluginMsg_Ext_CrxFileSystem_BrowserOpenReply>(BROWSER,
- PpapiHostMsg_Ext_CrxFileSystem_BrowserOpen(),
- base::Bind(&ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete, this,
- file_system_resource,
- callback));
+ Call<PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply>(BROWSER,
+ PpapiHostMsg_IsolatedFileSystem_BrowserOpen(type),
+ base::Bind(&IsolatedFileSystemPrivateResource::OnBrowserOpenComplete,
+ this, type, file_system_resource, callback));
return PP_OK_COMPLETIONPENDING;
}
-void ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete(
+void IsolatedFileSystemPrivateResource::OnBrowserOpenComplete(
+ PP_IsolatedFileSystemType_Private type,
PP_Resource* file_system_resource,
scoped_refptr<TrackedCallback> callback,
const ResourceMessageReplyParams& params,
@@ -75,7 +73,8 @@ void ExtCrxFileSystemPrivateResource::OnBrowserOpenComplete(
*file_system_resource = fs->GetReference();
if (*file_system_resource == 0)
callback->Run(PP_ERROR_FAILED);
- fs->InitIsolatedFileSystem(fsid, base::Bind(&RunTrackedCallback, callback));
+ fs->InitIsolatedFileSystem(
+ fsid, type, base::Bind(&RunTrackedCallback, callback));
}
} // namespace proxy
diff --git a/chromium/ppapi/proxy/ext_crx_file_system_private_resource.h b/chromium/ppapi/proxy/isolated_file_system_private_resource.h
index 5f2887a7181..6f3f5e6a5d8 100644
--- a/chromium/ppapi/proxy/ext_crx_file_system_private_resource.h
+++ b/chromium/ppapi/proxy/isolated_file_system_private_resource.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -16,8 +16,8 @@
// Once the plugin receives the fsid, it creates a PPB_FileSystem and forwards
// the fsid to PepperFileSystemHost in order to construct root url.
-#ifndef PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_
-#define PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_
+#ifndef PPAPI_PROXY_ISOLATED_FILE_SYSTEM_PRIVATE_RESOURCE_H_
+#define PPAPI_PROXY_ISOLATED_FILE_SYSTEM_PRIVATE_RESOURCE_H_
#include <string>
@@ -25,7 +25,7 @@
#include "ppapi/proxy/connection.h"
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
-#include "ppapi/thunk/ppb_ext_crx_file_system_private_api.h"
+#include "ppapi/thunk/ppb_isolated_file_system_private_api.h"
namespace ppapi {
@@ -35,34 +35,35 @@ namespace proxy {
class ResourceMessageReplyParams;
-class PPAPI_PROXY_EXPORT ExtCrxFileSystemPrivateResource
+class PPAPI_PROXY_EXPORT IsolatedFileSystemPrivateResource
: public PluginResource,
- public thunk::PPB_Ext_CrxFileSystem_Private_API {
+ public thunk::PPB_IsolatedFileSystem_Private_API {
public:
- ExtCrxFileSystemPrivateResource(Connection connection, PP_Instance instance);
- virtual ~ExtCrxFileSystemPrivateResource();
+ IsolatedFileSystemPrivateResource(
+ Connection connection, PP_Instance instance);
+ virtual ~IsolatedFileSystemPrivateResource();
// Resource overrides.
- virtual thunk::PPB_Ext_CrxFileSystem_Private_API*
- AsPPB_Ext_CrxFileSystem_Private_API() OVERRIDE;
+ virtual thunk::PPB_IsolatedFileSystem_Private_API*
+ AsPPB_IsolatedFileSystem_Private_API() OVERRIDE;
- // PPB_Ext_CrxFileSystem_Private_API implementation.
+ // PPB_IsolatedFileSystem_Private_API implementation.
virtual int32_t Open(PP_Instance instance,
+ PP_IsolatedFileSystemType_Private type,
PP_Resource* file_system_resource,
scoped_refptr<TrackedCallback> callback) OVERRIDE;
private:
- void OnBrowserOpenComplete(PP_Resource* file_system_resource,
+ void OnBrowserOpenComplete(PP_IsolatedFileSystemType_Private type,
+ PP_Resource* file_system_resource,
scoped_refptr<TrackedCallback> callback,
const ResourceMessageReplyParams& params,
const std::string& fsid);
- bool called_open_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtCrxFileSystemPrivateResource);
+ DISALLOW_COPY_AND_ASSIGN(IsolatedFileSystemPrivateResource);
};
} // namespace proxy
} // namespace ppapi
-#endif // PPAPI_PROXY_EXT_CRX_FILE_SYSTEM_PRIVATE_RESOURCE_H_
+#endif // PPAPI_PROXY_ISOLATED_FILE_SYSTEM_PRIVATE_RESOURCE_H_
diff --git a/chromium/ppapi/proxy/nacl_message_scanner.cc b/chromium/ppapi/proxy/nacl_message_scanner.cc
new file mode 100644
index 00000000000..027975eb66c
--- /dev/null
+++ b/chromium/ppapi/proxy/nacl_message_scanner.cc
@@ -0,0 +1,298 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/nacl_message_scanner.h"
+
+#include <vector>
+#include "base/bind.h"
+#include "ipc/ipc_message.h"
+#include "ipc/ipc_message_macros.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/proxy/serialized_handle.h"
+#include "ppapi/proxy/serialized_var.h"
+
+class NaClDescImcShm;
+
+namespace IPC {
+class Message;
+}
+
+namespace {
+
+typedef std::vector<ppapi::proxy::SerializedHandle> Handles;
+
+struct ScanningResults {
+ ScanningResults() : handle_index(0) {}
+
+ // Vector to hold handles found in the message.
+ Handles handles;
+ // Current handle index in the rewritten message. During the scan, it will be
+ // be less than or equal to handles.size(). After the scan it should be equal.
+ int handle_index;
+ // The rewritten message. This may be NULL, so all ScanParam overloads should
+ // check for NULL before writing to it. In some cases, a ScanParam overload
+ // may set this to NULL when it can determine that there are no parameters
+ // that need conversion. (See the ResourceMessageReplyParams overload.)
+ scoped_ptr<IPC::Message> new_msg;
+};
+
+void WriteHandle(int handle_index,
+ const ppapi::proxy::SerializedHandle& handle,
+ IPC::Message* msg) {
+ ppapi::proxy::SerializedHandle::WriteHeader(handle.header(), msg);
+
+ // Now write the handle itself in POSIX style.
+ msg->WriteBool(true); // valid == true
+ msg->WriteInt(handle_index);
+}
+
+// Define overloads for each kind of message parameter that requires special
+// handling. See ScanTuple for how these get used.
+
+// Overload to match SerializedHandle.
+void ScanParam(const ppapi::proxy::SerializedHandle& handle,
+ ScanningResults* results) {
+ results->handles.push_back(handle);
+ if (results->new_msg)
+ WriteHandle(results->handle_index++, handle, results->new_msg.get());
+}
+
+void HandleWriter(int* handle_index,
+ IPC::Message* m,
+ const ppapi::proxy::SerializedHandle& handle) {
+ WriteHandle((*handle_index)++, handle, m);
+}
+
+// Overload to match SerializedVar, which can contain handles.
+void ScanParam(const ppapi::proxy::SerializedVar& var,
+ ScanningResults* results) {
+ std::vector<ppapi::proxy::SerializedHandle*> var_handles = var.GetHandles();
+ // Copy any handles and then rewrite the message.
+ for (size_t i = 0; i < var_handles.size(); ++i)
+ results->handles.push_back(*var_handles[i]);
+ if (results->new_msg)
+ var.WriteDataToMessage(results->new_msg.get(),
+ base::Bind(&HandleWriter, &results->handle_index));
+}
+
+// For PpapiMsg_ResourceReply and the reply to PpapiHostMsg_ResourceSyncCall,
+// the handles are carried inside the ResourceMessageReplyParams.
+// NOTE: We only intercept handles from host->NaCl. The only kind of
+// ResourceMessageParams that travels this direction is
+// ResourceMessageReplyParams, so that's the only one we need to handle.
+void ScanParam(const ppapi::proxy::ResourceMessageReplyParams& params,
+ ScanningResults* results) {
+ // If the resource reply params don't contain handles, NULL the new message
+ // pointer to cancel further rewriting.
+ // NOTE: This works because only handles currently need rewriting, and we
+ // know at this point that this message has none.
+ if (params.handles().empty()) {
+ results->new_msg.reset(NULL);
+ return;
+ }
+
+ // If we need to rewrite the message, write everything before the handles
+ // (there's nothing after the handles).
+ if (results->new_msg) {
+ params.WriteReplyHeader(results->new_msg.get());
+ // IPC writes the vector length as an int before the contents of the
+ // vector.
+ results->new_msg->WriteInt(static_cast<int>(params.handles().size()));
+ }
+ for (Handles::const_iterator iter = params.handles().begin();
+ iter != params.handles().end();
+ ++iter) {
+ // ScanParam will write each handle to the new message, if necessary.
+ ScanParam(*iter, results);
+ }
+ // Tell ResourceMessageReplyParams that we have taken the handles, so it
+ // shouldn't close them. The NaCl runtime will take ownership of them.
+ params.ConsumeHandles();
+}
+
+// Overload to match all other types. If we need to rewrite the message,
+// write the parameter.
+template <class T>
+void ScanParam(const T& param, ScanningResults* results) {
+ if (results->new_msg)
+ IPC::WriteParam(results->new_msg.get(), param);
+}
+
+// These just break apart the given tuple and run ScanParam over each param.
+// The idea is to scan elements in the tuple which require special handling,
+// and write them into the |results| struct.
+template <class A>
+void ScanTuple(const Tuple1<A>& t1, ScanningResults* results) {
+ ScanParam(t1.a, results);
+}
+template <class A, class B>
+void ScanTuple(const Tuple2<A, B>& t1, ScanningResults* results) {
+ ScanParam(t1.a, results);
+ ScanParam(t1.b, results);
+}
+template <class A, class B, class C>
+void ScanTuple(const Tuple3<A, B, C>& t1, ScanningResults* results) {
+ ScanParam(t1.a, results);
+ ScanParam(t1.b, results);
+ ScanParam(t1.c, results);
+}
+template <class A, class B, class C, class D>
+void ScanTuple(const Tuple4<A, B, C, D>& t1, ScanningResults* results) {
+ ScanParam(t1.a, results);
+ ScanParam(t1.b, results);
+ ScanParam(t1.c, results);
+ ScanParam(t1.d, results);
+}
+
+template <class MessageType>
+class MessageScannerImpl {
+ public:
+ explicit MessageScannerImpl(const IPC::Message* msg)
+ : msg_(static_cast<const MessageType*>(msg)) {
+ }
+ bool ScanMessage(ScanningResults* results) {
+ typename TupleTypes<typename MessageType::Schema::Param>::ValueTuple params;
+ if (!MessageType::Read(msg_, &params))
+ return false;
+ ScanTuple(params, results);
+ return true;
+ }
+
+ bool ScanReply(ScanningResults* results) {
+ typename TupleTypes<typename MessageType::Schema::ReplyParam>::ValueTuple
+ params;
+ if (!MessageType::ReadReplyParam(msg_, &params))
+ return false;
+ // If we need to rewrite the message, write the message id first.
+ if (results->new_msg) {
+ results->new_msg->set_reply();
+ int id = IPC::SyncMessage::GetMessageId(*msg_);
+ results->new_msg->WriteInt(id);
+ }
+ ScanTuple(params, results);
+ return true;
+ }
+ // TODO(dmichael): Add ScanSyncMessage for outgoing sync messages, if we ever
+ // need to scan those.
+
+ private:
+ const MessageType* msg_;
+};
+
+} // namespace
+
+#define CASE_FOR_MESSAGE(MESSAGE_TYPE) \
+ case MESSAGE_TYPE::ID: { \
+ MessageScannerImpl<MESSAGE_TYPE> scanner(&msg); \
+ if (rewrite_msg) \
+ results.new_msg.reset( \
+ new IPC::Message(msg.routing_id(), msg.type(), \
+ IPC::Message::PRIORITY_NORMAL)); \
+ if (!scanner.ScanMessage(&results)) \
+ return false; \
+ break; \
+ }
+#define CASE_FOR_REPLY(MESSAGE_TYPE) \
+ case MESSAGE_TYPE::ID: { \
+ MessageScannerImpl<MESSAGE_TYPE> scanner(&msg); \
+ if (rewrite_msg) \
+ results.new_msg.reset( \
+ new IPC::Message(msg.routing_id(), msg.type(), \
+ IPC::Message::PRIORITY_NORMAL)); \
+ if (!scanner.ScanReply(&results)) \
+ return false; \
+ break; \
+ }
+
+namespace ppapi {
+namespace proxy {
+
+class SerializedHandle;
+
+NaClMessageScanner::NaClMessageScanner() {
+}
+
+// Windows IPC differs from POSIX in that native handles are serialized in the
+// message body, rather than passed in a separate FileDescriptorSet. Therefore,
+// on Windows, any message containing handles must be rewritten in the POSIX
+// format before we can send it to the NaCl plugin.
+//
+// On POSIX and Windows we have to rewrite PpapiMsg_CreateNaClChannel messages.
+// These contain a handle with an invalid (place holder) descriptor. We need to
+// locate this handle so it can be replaced with a valid one when the channel is
+// created.
+bool NaClMessageScanner::ScanMessage(
+ const IPC::Message& msg,
+ std::vector<SerializedHandle>* handles,
+ scoped_ptr<IPC::Message>* new_msg_ptr) {
+ DCHECK(handles);
+ DCHECK(handles->empty());
+ DCHECK(new_msg_ptr);
+ DCHECK(!new_msg_ptr->get());
+
+ bool rewrite_msg =
+#if defined(OS_WIN)
+ true;
+#else
+ (msg.type() == PpapiMsg_CreateNaClChannel::ID);
+#endif
+
+
+ // We can't always tell from the message ID if rewriting is needed. Therefore,
+ // scan any message types that might contain a handle. If we later determine
+ // that there are no handles, we can cancel the rewriting by clearing the
+ // results.new_msg pointer.
+ ScanningResults results;
+ switch (msg.type()) {
+ CASE_FOR_MESSAGE(PpapiMsg_CreateNaClChannel)
+ CASE_FOR_MESSAGE(PpapiMsg_PPBAudio_NotifyAudioStreamCreated)
+ CASE_FOR_MESSAGE(PpapiMsg_PPPMessaging_HandleMessage)
+ CASE_FOR_MESSAGE(PpapiPluginMsg_ResourceReply)
+ case IPC_REPLY_ID: {
+ int id = IPC::SyncMessage::GetMessageId(msg);
+ PendingSyncMsgMap::iterator iter(pending_sync_msgs_.find(id));
+ if (iter == pending_sync_msgs_.end()) {
+ NOTREACHED();
+ return false;
+ }
+ uint32_t type = iter->second;
+ pending_sync_msgs_.erase(iter);
+ switch (type) {
+ CASE_FOR_REPLY(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer)
+ CASE_FOR_REPLY(PpapiHostMsg_PPBImageData_CreateSimple)
+ CASE_FOR_REPLY(PpapiHostMsg_ResourceSyncCall)
+ CASE_FOR_REPLY(PpapiHostMsg_SharedMemory_CreateSharedMemory)
+ default:
+ // Do nothing for messages we don't know.
+ break;
+ }
+ break;
+ }
+ default:
+ // Do nothing for messages we don't know.
+ break;
+ }
+
+ // Only messages containing handles need to be rewritten. If no handles are
+ // found, don't return the rewritten message either. This must be changed if
+ // we ever add new param types that also require rewriting.
+ if (!results.handles.empty()) {
+ handles->swap(results.handles);
+ *new_msg_ptr = results.new_msg.Pass();
+ }
+ return true;
+}
+
+void NaClMessageScanner::RegisterSyncMessageForReply(const IPC::Message& msg) {
+ DCHECK(msg.is_sync());
+
+ int msg_id = IPC::SyncMessage::GetMessageId(msg);
+ DCHECK(pending_sync_msgs_.find(msg_id) == pending_sync_msgs_.end());
+
+ pending_sync_msgs_[msg_id] = msg.type();
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/chromium/ppapi/proxy/nacl_message_scanner.h b/chromium/ppapi/proxy/nacl_message_scanner.h
new file mode 100644
index 00000000000..cce821b7f0c
--- /dev/null
+++ b/chromium/ppapi/proxy/nacl_message_scanner.h
@@ -0,0 +1,62 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_
+#define PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_
+
+#include <map>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+namespace proxy {
+
+class SerializedHandle;
+
+class PPAPI_PROXY_EXPORT NaClMessageScanner {
+ public:
+ NaClMessageScanner();
+
+ // Scans the message for items that require special handling. Copies any
+ // SerializedHandles in the message into |handles| and if the message must be
+ // rewritten for NaCl, sets |new_msg_ptr| to the new message. If no handles
+ // are found, |handles| is left unchanged. If no rewriting is needed,
+ // |new_msg_ptr| is left unchanged.
+ //
+ // See more explanation in the method definition.
+ //
+ // See chrome/nacl/nacl_ipc_adapter.cc for where this is used to help convert
+ // native handles to NaClDescs.
+ bool ScanMessage(const IPC::Message& msg,
+ std::vector<SerializedHandle>* handles,
+ scoped_ptr<IPC::Message>* new_msg_ptr);
+
+ // This method informs NaClMessageScanner that a sync message is being sent
+ // so that it can associate reply messages with their type.
+ //
+ // Users of NaClMessageScanner must call this when they send a synchronous
+ // message, otherwise NaClMessageScanner won't scan replies.
+ void RegisterSyncMessageForReply(const IPC::Message& msg);
+
+ private:
+ // When we send a synchronous message (from untrusted to trusted), we store
+ // its type here, so that later we can associate the reply with its type
+ // for scanning.
+ typedef std::map<int, uint32> PendingSyncMsgMap;
+ PendingSyncMsgMap pending_sync_msgs_;
+
+ DISALLOW_COPY_AND_ASSIGN(NaClMessageScanner);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_NACL_MESSAGE_SCANNER_H_
diff --git a/chromium/ppapi/proxy/output_protection_resource.cc b/chromium/ppapi/proxy/output_protection_resource.cc
new file mode 100644
index 00000000000..8f601de453a
--- /dev/null
+++ b/chromium/ppapi/proxy/output_protection_resource.cc
@@ -0,0 +1,105 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/output_protection_resource.h"
+
+#include "base/logging.h"
+#include "ppapi/proxy/plugin_globals.h"
+#include "ppapi/proxy/plugin_resource_tracker.h"
+#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/resource_tracker.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_output_protection_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+OutputProtectionResource::OutputProtectionResource(
+ Connection connection,
+ PP_Instance instance)
+ : PluginResource(connection, instance) {
+ SendCreate(BROWSER, PpapiHostMsg_OutputProtection_Create());
+}
+
+OutputProtectionResource::~OutputProtectionResource() {
+ if (TrackedCallback::IsPending(query_status_callback_))
+ query_status_callback_->PostAbort();
+ if (TrackedCallback::IsPending(enable_protection_callback_))
+ enable_protection_callback_->PostAbort();
+}
+
+thunk::PPB_OutputProtection_API*
+ OutputProtectionResource::AsPPB_OutputProtection_API() {
+ return this;
+}
+
+int32_t OutputProtectionResource::QueryStatus(
+ uint32_t* link_mask,
+ uint32_t* protection_mask,
+ const scoped_refptr<TrackedCallback>& callback) {
+ if (!link_mask || !protection_mask)
+ return PP_ERROR_BADARGUMENT;
+ if (TrackedCallback::IsPending(query_status_callback_))
+ return PP_ERROR_INPROGRESS;
+
+ query_status_callback_ = callback;
+
+ Call<PpapiPluginMsg_OutputProtection_QueryStatusReply>(
+ BROWSER,
+ PpapiHostMsg_OutputProtection_QueryStatus(),
+ base::Bind(&OutputProtectionResource::OnPluginMsgQueryStatusReply,
+ base::Unretained(this),
+ link_mask,
+ protection_mask));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+void OutputProtectionResource::OnPluginMsgQueryStatusReply(
+ uint32_t* out_link_mask,
+ uint32_t* out_protection_mask,
+ const ResourceMessageReplyParams& params,
+ uint32_t link_mask,
+ uint32_t protection_mask) {
+ // The callback may have been aborted.
+ if (!TrackedCallback::IsPending(query_status_callback_))
+ return;
+
+ int32_t result = params.result();
+
+ if (result == PP_OK) {
+ DCHECK(out_link_mask);
+ DCHECK(out_protection_mask);
+ *out_link_mask = link_mask;
+ *out_protection_mask = protection_mask;
+ }
+ query_status_callback_->Run(result);
+}
+
+int32_t OutputProtectionResource::EnableProtection(
+ uint32_t desired_method_mask,
+ const scoped_refptr<TrackedCallback>& callback) {
+ if (TrackedCallback::IsPending(enable_protection_callback_))
+ return PP_ERROR_INPROGRESS;
+
+ enable_protection_callback_ = callback;
+
+ Call<PpapiPluginMsg_OutputProtection_EnableProtectionReply>(
+ BROWSER,
+ PpapiHostMsg_OutputProtection_EnableProtection(desired_method_mask),
+ base::Bind(&OutputProtectionResource::OnPluginMsgEnableProtectionReply,
+ base::Unretained(this)));
+ return PP_OK_COMPLETIONPENDING;
+}
+
+void OutputProtectionResource::OnPluginMsgEnableProtectionReply(
+ const ResourceMessageReplyParams& params) {
+ // The callback may have been aborted.
+ if (TrackedCallback::IsPending(enable_protection_callback_))
+ enable_protection_callback_->Run(params.result());
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/chromium/ppapi/proxy/output_protection_resource.h b/chromium/ppapi/proxy/output_protection_resource.h
new file mode 100644
index 00000000000..b56a33d7b22
--- /dev/null
+++ b/chromium/ppapi/proxy/output_protection_resource.h
@@ -0,0 +1,58 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_OUTPUT_PROTECTION_RESOURCE_H_
+#define PPAPI_PROXY_OUTPUT_PROTECTION_RESOURCE_H_
+
+#include "base/compiler_specific.h"
+#include "ppapi/c/private/ppb_output_protection_private.h"
+#include "ppapi/proxy/device_enumeration_resource_helper.h"
+#include "ppapi/proxy/plugin_resource.h"
+#include "ppapi/thunk/ppb_output_protection_api.h"
+
+namespace ppapi {
+namespace proxy {
+
+class OutputProtectionResource
+ : public PluginResource,
+ public ::ppapi::thunk::PPB_OutputProtection_API {
+ public:
+ OutputProtectionResource(Connection connection,
+ PP_Instance instance);
+
+ private:
+ virtual ~OutputProtectionResource();
+
+ // PluginResource overrides.
+ virtual thunk::PPB_OutputProtection_API* AsPPB_OutputProtection_API()
+ OVERRIDE;
+
+ // PPB_OutputProtection_API implementation.
+ virtual int32_t QueryStatus(
+ uint32_t* link_mask,
+ uint32_t* protection_mask,
+ const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
+ virtual int32_t EnableProtection(
+ uint32_t desired_method_mask,
+ const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
+
+ void OnPluginMsgQueryStatusReply(
+ uint32_t* out_link_mask,
+ uint32_t* out_protection_mask,
+ const ResourceMessageReplyParams& params,
+ uint32_t link_mask,
+ uint32_t protection_mask);
+ void OnPluginMsgEnableProtectionReply(
+ const ResourceMessageReplyParams& params);
+
+ scoped_refptr<TrackedCallback> query_status_callback_;
+ scoped_refptr<TrackedCallback> enable_protection_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(OutputProtectionResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_OUTPUT_PROTECTION_RESOURCE_H_
diff --git a/chromium/ppapi/proxy/pdf_resource.cc b/chromium/ppapi/proxy/pdf_resource.cc
index 8e0a2e0bbf1..80c4237a5e5 100644
--- a/chromium/ppapi/proxy/pdf_resource.cc
+++ b/chromium/ppapi/proxy/pdf_resource.cc
@@ -188,5 +188,9 @@ PP_Resource PDFResource::GetResourceImage(PP_ResourceImage image_id) {
return GetResourceImageForScale(image_id, 1.0f);
}
+PP_Bool PDFResource::IsOutOfProcess() {
+ return PP_TRUE;
+}
+
} // namespace proxy
} // namespace ppapi
diff --git a/chromium/ppapi/proxy/pdf_resource.h b/chromium/ppapi/proxy/pdf_resource.h
index 704e1d4a44e..4ab30ba1ca7 100644
--- a/chromium/ppapi/proxy/pdf_resource.h
+++ b/chromium/ppapi/proxy/pdf_resource.h
@@ -54,6 +54,7 @@ class PPAPI_PROXY_EXPORT PDFResource
virtual PP_Resource GetResourceImageForScale(PP_ResourceImage image_id,
float scale) OVERRIDE;
virtual PP_Resource GetResourceImage(PP_ResourceImage image_id) OVERRIDE;
+ virtual PP_Bool IsOutOfProcess() OVERRIDE;
private:
std::string locale_;
diff --git a/chromium/ppapi/proxy/platform_verification_private_resource.cc b/chromium/ppapi/proxy/platform_verification_private_resource.cc
index 4da3ca0f34e..d361f4f8279 100644
--- a/chromium/ppapi/proxy/platform_verification_private_resource.cc
+++ b/chromium/ppapi/proxy/platform_verification_private_resource.cc
@@ -30,35 +30,6 @@ PlatformVerificationPrivateResource::AsPPB_PlatformVerification_API() {
return this;
}
-int32_t PlatformVerificationPrivateResource::CanChallengePlatform(
- PP_Bool* can_challenge_platform,
- const scoped_refptr<TrackedCallback>& callback) {
- if (!can_challenge_platform)
- return PP_ERROR_BADARGUMENT;
-
- Call<PpapiHostMsg_PlatformVerification_CanChallengePlatformReply>(
- BROWSER, PpapiHostMsg_PlatformVerification_CanChallengePlatform(),
- base::Bind(
- &PlatformVerificationPrivateResource::OnCanChallengePlatformReply,
- base::Unretained(this), can_challenge_platform, callback));
-
- return PP_OK_COMPLETIONPENDING;
-}
-
-void PlatformVerificationPrivateResource::OnCanChallengePlatformReply(
- PP_Bool* can_challenge_platform,
- const scoped_refptr<TrackedCallback>& callback,
- const ResourceMessageReplyParams& params,
- bool can_challenge_platform_response) {
- if (!TrackedCallback::IsPending(callback) ||
- TrackedCallback::IsScheduledToRun(callback)) {
- return;
- }
-
- *can_challenge_platform = PP_FromBool(can_challenge_platform_response);
- callback->Run(params.result());
-}
-
int32_t PlatformVerificationPrivateResource::ChallengePlatform(
const PP_Var& service_id,
const PP_Var& challenge,
diff --git a/chromium/ppapi/proxy/platform_verification_private_resource.h b/chromium/ppapi/proxy/platform_verification_private_resource.h
index ba7d3b14014..a12a137aacb 100644
--- a/chromium/ppapi/proxy/platform_verification_private_resource.h
+++ b/chromium/ppapi/proxy/platform_verification_private_resource.h
@@ -34,9 +34,6 @@ class PPAPI_PROXY_EXPORT PlatformVerificationPrivateResource
AsPPB_PlatformVerification_API() OVERRIDE;
// PPB_PlatformVerification_API implementation.
- virtual int32_t CanChallengePlatform(
- PP_Bool* can_challenge_platform,
- const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
virtual int32_t ChallengePlatform(
const PP_Var& service_id,
const PP_Var& challenge,
@@ -44,12 +41,6 @@ class PPAPI_PROXY_EXPORT PlatformVerificationPrivateResource
PP_Var* signed_data_signature,
PP_Var* platform_key_certificate,
const scoped_refptr<TrackedCallback>& callback) OVERRIDE;
-
- void OnCanChallengePlatformReply(
- PP_Bool* can_challenge_platform,
- const scoped_refptr<TrackedCallback>& callback,
- const ResourceMessageReplyParams& params,
- bool can_challenge_platform_response);
void OnChallengePlatformReply(
ChallengePlatformParams output_params,
const ResourceMessageReplyParams& params,
diff --git a/chromium/ppapi/proxy/plugin_dispatcher.cc b/chromium/ppapi/proxy/plugin_dispatcher.cc
index d6d0d909765..6cd0ab4151d 100644
--- a/chromium/ppapi/proxy/plugin_dispatcher.cc
+++ b/chromium/ppapi/proxy/plugin_dispatcher.cc
@@ -29,13 +29,12 @@
#include "ppapi/proxy/ppb_instance_proxy.h"
#include "ppapi/proxy/ppp_class_proxy.h"
#include "ppapi/proxy/resource_creation_proxy.h"
-#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/proxy/resource_reply_thread_registrar.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/proxy_lock.h"
#include "ppapi/shared_impl/resource.h"
#if defined(OS_POSIX) && !defined(OS_NACL)
-#include "base/posix/eintr_wrapper.h"
#include "ipc/ipc_channel_posix.h"
#endif
@@ -174,7 +173,9 @@ bool PluginDispatcher::InitPluginWithChannel(
// The message filter will intercept and process certain messages directly
// on the I/O thread.
channel()->AddFilter(
- new PluginMessageFilter(delegate->GetGloballySeenInstanceIDSet()));
+ new PluginMessageFilter(
+ delegate->GetGloballySeenInstanceIDSet(),
+ PluginGlobals::Get()->resource_reply_thread_registrar()));
return true;
}
@@ -227,7 +228,6 @@ bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) {
// Handle some plugin-specific control messages.
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg)
- IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply)
IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface)
IPC_MESSAGE_HANDLER(PpapiMsg_SetPreferences, OnMsgSetPreferences)
IPC_MESSAGE_UNHANDLED(handled = false);
@@ -288,16 +288,6 @@ thunk::ResourceCreationAPI* PluginDispatcher::GetResourceCreationAPI() {
GetInterfaceProxy(API_ID_RESOURCE_CREATION));
}
-// static
-void PluginDispatcher::DispatchResourceReply(
- const ppapi::proxy::ResourceMessageReplyParams& reply_params,
- const IPC::Message& nested_msg) {
- // We need to grab the proxy lock to ensure that we don't collide with the
- // plugin making pepper calls on a different thread.
- ProxyAutoLock lock;
- LockedDispatchResourceReply(reply_params, nested_msg);
-}
-
void PluginDispatcher::ForceFreeAllInstances() {
if (!g_instance_to_dispatcher)
return;
@@ -316,12 +306,6 @@ void PluginDispatcher::ForceFreeAllInstances() {
}
}
-void PluginDispatcher::OnMsgResourceReply(
- const ppapi::proxy::ResourceMessageReplyParams& reply_params,
- const IPC::Message& nested_msg) {
- LockedDispatchResourceReply(reply_params, nested_msg);
-}
-
void PluginDispatcher::OnMsgSupportsInterface(
const std::string& interface_name,
bool* result) {
@@ -350,20 +334,5 @@ void PluginDispatcher::OnMsgSetPreferences(const Preferences& prefs) {
}
}
-// static
-void PluginDispatcher::LockedDispatchResourceReply(
- const ppapi::proxy::ResourceMessageReplyParams& reply_params,
- const IPC::Message& nested_msg) {
- Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource(
- reply_params.pp_resource());
- if (!resource) {
- DLOG_IF(INFO, reply_params.sequence() != 0)
- << "Pepper resource reply message received but the resource doesn't "
- "exist (probably has been destroyed).";
- return;
- }
- resource->OnReplyReceived(reply_params, nested_msg);
-}
-
} // namespace proxy
} // namespace ppapi
diff --git a/chromium/ppapi/proxy/plugin_dispatcher.h b/chromium/ppapi/proxy/plugin_dispatcher.h
index 3a9e7330865..5176eba7c74 100644
--- a/chromium/ppapi/proxy/plugin_dispatcher.h
+++ b/chromium/ppapi/proxy/plugin_dispatcher.h
@@ -40,8 +40,6 @@ class ResourceCreationAPI;
namespace proxy {
-class ResourceMessageReplyParams;
-
// Used to keep track of per-instance data.
struct InstanceData {
InstanceData();
@@ -163,13 +161,6 @@ class PPAPI_PROXY_EXPORT PluginDispatcher
uint32 plugin_dispatcher_id() const { return plugin_dispatcher_id_; }
bool incognito() const { return incognito_; }
- // Dispatches the given resource message to the appropriate resource in the
- // plugin process. This should be wired to the various channels that messages
- // come in from various other processes.
- static void DispatchResourceReply(
- const ppapi::proxy::ResourceMessageReplyParams& reply_params,
- const IPC::Message& nested_msg);
-
private:
friend class PluginDispatcherTest;
@@ -178,17 +169,9 @@ class PPAPI_PROXY_EXPORT PluginDispatcher
void ForceFreeAllInstances();
// IPC message handlers.
- void OnMsgResourceReply(
- const ppapi::proxy::ResourceMessageReplyParams& reply_params,
- const IPC::Message& nested_msg);
void OnMsgSupportsInterface(const std::string& interface_name, bool* result);
void OnMsgSetPreferences(const Preferences& prefs);
- // Internal backed for DispatchResourceReply.
- static void LockedDispatchResourceReply(
- const ppapi::proxy::ResourceMessageReplyParams& reply_params,
- const IPC::Message& nested_msg);
-
virtual bool SendMessage(IPC::Message* msg);
PluginDelegate* plugin_delegate_;
diff --git a/chromium/ppapi/proxy/plugin_globals.cc b/chromium/ppapi/proxy/plugin_globals.cc
index 83217f0d96b..59b51919e1a 100644
--- a/chromium/ppapi/proxy/plugin_globals.cc
+++ b/chromium/ppapi/proxy/plugin_globals.cc
@@ -11,6 +11,7 @@
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_proxy_delegate.h"
#include "ppapi/proxy/ppb_message_loop_proxy.h"
+#include "ppapi/proxy/resource_reply_thread_registrar.h"
#include "ppapi/shared_impl/proxy_lock.h"
#include "ppapi/thunk/enter.h"
@@ -51,7 +52,9 @@ PluginGlobals* PluginGlobals::plugin_globals_ = NULL;
PluginGlobals::PluginGlobals()
: ppapi::PpapiGlobals(),
plugin_proxy_delegate_(NULL),
- callback_tracker_(new CallbackTracker) {
+ callback_tracker_(new CallbackTracker),
+ resource_reply_thread_registrar_(
+ new ResourceReplyThreadRegistrar(GetMainThreadMessageLoop())) {
DCHECK(!plugin_globals_);
plugin_globals_ = this;
@@ -66,7 +69,9 @@ PluginGlobals::PluginGlobals()
PluginGlobals::PluginGlobals(PerThreadForTest per_thread_for_test)
: ppapi::PpapiGlobals(per_thread_for_test),
plugin_proxy_delegate_(NULL),
- callback_tracker_(new CallbackTracker) {
+ callback_tracker_(new CallbackTracker),
+ resource_reply_thread_registrar_(
+ new ResourceReplyThreadRegistrar(GetMainThreadMessageLoop())) {
DCHECK(!plugin_globals_);
}
@@ -150,7 +155,7 @@ MessageLoopShared* PluginGlobals::GetCurrentMessageLoop() {
return MessageLoopResource::GetCurrent();
}
-base::TaskRunner* PluginGlobals::GetFileTaskRunner(PP_Instance instance) {
+base::TaskRunner* PluginGlobals::GetFileTaskRunner() {
if (!file_thread_.get()) {
file_thread_.reset(new base::Thread("Plugin::File"));
base::Thread::Options options;
diff --git a/chromium/ppapi/proxy/plugin_globals.h b/chromium/ppapi/proxy/plugin_globals.h
index 31adef55841..029e2d2e28e 100644
--- a/chromium/ppapi/proxy/plugin_globals.h
+++ b/chromium/ppapi/proxy/plugin_globals.h
@@ -34,6 +34,7 @@ namespace proxy {
class MessageLoopResource;
class PluginProxyDelegate;
+class ResourceReplyThreadRegistrar;
class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
public:
@@ -72,7 +73,7 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
const std::string& source,
const std::string& value) OVERRIDE;
virtual MessageLoopShared* GetCurrentMessageLoop() OVERRIDE;
- base::TaskRunner* GetFileTaskRunner(PP_Instance instance) OVERRIDE;
+ base::TaskRunner* GetFileTaskRunner() OVERRIDE;
// Returns the channel for sending to the browser.
IPC::Sender* GetBrowserSender();
@@ -128,6 +129,10 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
// The embedder should call this function when the command line is known.
void set_command_line(const std::string& c) { command_line_ = c; }
+ ResourceReplyThreadRegistrar* resource_reply_thread_registrar() {
+ return resource_reply_thread_registrar_.get();
+ }
+
private:
class BrowserSender;
@@ -160,6 +165,8 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
// lazily, since it might not be needed.
scoped_ptr<base::Thread> file_thread_;
+ scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_;
+
DISALLOW_COPY_AND_ASSIGN(PluginGlobals);
};
diff --git a/chromium/ppapi/proxy/plugin_main_nacl.cc b/chromium/ppapi/proxy/plugin_main_nacl.cc
index 5978233a537..985deb7bd12 100644
--- a/chromium/ppapi/proxy/plugin_main_nacl.cc
+++ b/chromium/ppapi/proxy/plugin_main_nacl.cc
@@ -26,7 +26,9 @@
#include "ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_globals.h"
+#include "ppapi/proxy/plugin_message_filter.h"
#include "ppapi/proxy/plugin_proxy_delegate.h"
+#include "ppapi/proxy/resource_reply_thread_registrar.h"
#include "ppapi/shared_impl/ppb_audio_shared.h"
#if defined(IPC_MESSAGE_LOG_ENABLED)
@@ -91,9 +93,6 @@ class PpapiDispatcher : public ProxyChannel,
void OnMsgCreateNaClChannel(int renderer_id,
const ppapi::PpapiNaClChannelArgs& args,
SerializedHandle handle);
- void OnMsgResourceReply(
- const ppapi::proxy::ResourceMessageReplyParams& reply_params,
- const IPC::Message& nested_msg);
void OnPluginDispatcherMessageReceived(const IPC::Message& msg);
std::set<PP_Instance> instances_;
@@ -113,6 +112,8 @@ PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop)
// NaCl sandbox.
InitWithChannel(this, base::kNullProcessId, channel_handle,
false); // Channel is server.
+ channel()->AddFilter(new ppapi::proxy::PluginMessageFilter(
+ NULL, PluginGlobals::Get()->resource_reply_thread_registrar()));
channel()->AddFilter(
new tracing::ChildTraceMessageFilter(message_loop_.get()));
}
@@ -186,7 +187,6 @@ PP_Resource PpapiDispatcher::CreateBrowserFont(
bool PpapiDispatcher::OnMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(PpapiDispatcher, msg)
IPC_MESSAGE_HANDLER(PpapiMsg_CreateNaClChannel, OnMsgCreateNaClChannel)
- IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply)
// All other messages are simply forwarded to a PluginDispatcher.
IPC_MESSAGE_UNHANDLED(OnPluginDispatcherMessageReceived(msg))
IPC_END_MESSAGE_MAP()
@@ -214,6 +214,14 @@ void PpapiDispatcher::OnMsgCreateNaClChannel(
// plugin.
ppapi::proxy::InterfaceList::SetProcessGlobalPermissions(
args.permissions);
+ ppapi::proxy::InterfaceList::SetSupportsDevChannel(
+ args.supports_dev_channel);
+
+ int32_t error = ::PPP_InitializeModule(
+ 0 /* module */,
+ &ppapi::proxy::PluginDispatcher::GetBrowserInterface);
+ if (error)
+ ::exit(error);
PluginDispatcher* dispatcher =
new PluginDispatcher(::PPP_GetInterface, args.permissions,
@@ -229,13 +237,6 @@ void PpapiDispatcher::OnMsgCreateNaClChannel(
// lifetime of the attached channel.
}
-void PpapiDispatcher::OnMsgResourceReply(
- const ppapi::proxy::ResourceMessageReplyParams& reply_params,
- const IPC::Message& nested_msg) {
- ppapi::proxy::PluginDispatcher::DispatchResourceReply(reply_params,
- nested_msg);
-}
-
void PpapiDispatcher::OnPluginDispatcherMessageReceived(
const IPC::Message& msg) {
// The first parameter should be a plugin dispatcher ID.
@@ -280,13 +281,6 @@ int PpapiPluginMain() {
return 1;
}
- int32_t error = ::PPP_InitializeModule(
- 0 /* module */,
- &ppapi::proxy::PluginDispatcher::GetBrowserInterface);
- // TODO(dmichael): Handle other error conditions, like failure to connect?
- if (error)
- return error;
-
PpapiDispatcher ppapi_dispatcher(io_thread.message_loop_proxy());
plugin_globals.set_plugin_proxy_delegate(&ppapi_dispatcher);
diff --git a/chromium/ppapi/proxy/plugin_message_filter.cc b/chromium/ppapi/proxy/plugin_message_filter.cc
index 9f178f15acc..1a62d21454b 100644
--- a/chromium/ppapi/proxy/plugin_message_filter.cc
+++ b/chromium/ppapi/proxy/plugin_message_filter.cc
@@ -4,14 +4,24 @@
#include "ppapi/proxy/plugin_message_filter.h"
+#include "base/bind.h"
+#include "base/logging.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/proxy/resource_reply_thread_registrar.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/resource.h"
+#include "ppapi/shared_impl/resource_tracker.h"
namespace ppapi {
namespace proxy {
PluginMessageFilter::PluginMessageFilter(
- std::set<PP_Instance>* seen_instance_ids)
+ std::set<PP_Instance>* seen_instance_ids,
+ scoped_refptr<ResourceReplyThreadRegistrar> registrar)
: seen_instance_ids_(seen_instance_ids),
+ resource_reply_thread_registrar_(registrar),
channel_(NULL) {
}
@@ -30,6 +40,7 @@ bool PluginMessageFilter::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PluginMessageFilter, message)
IPC_MESSAGE_HANDLER(PpapiMsg_ReserveInstanceId, OnMsgReserveInstanceId)
+ IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -42,8 +53,18 @@ bool PluginMessageFilter::Send(IPC::Message* msg) {
return false;
}
+// static
+void PluginMessageFilter::DispatchResourceReplyForTest(
+ const ResourceMessageReplyParams& reply_params,
+ const IPC::Message& nested_msg) {
+ DispatchResourceReply(reply_params, nested_msg);
+}
+
void PluginMessageFilter::OnMsgReserveInstanceId(PP_Instance instance,
bool* usable) {
+ // If |seen_instance_ids_| is set to NULL, we are not supposed to see this
+ // message.
+ CHECK(seen_instance_ids_);
// See the message definition for how this works.
if (seen_instance_ids_->find(instance) != seen_instance_ids_->end()) {
// Instance ID already seen, reject it.
@@ -57,5 +78,33 @@ void PluginMessageFilter::OnMsgReserveInstanceId(PP_Instance instance,
*usable = true;
}
+void PluginMessageFilter::OnMsgResourceReply(
+ const ResourceMessageReplyParams& reply_params,
+ const IPC::Message& nested_msg) {
+ scoped_refptr<base::MessageLoopProxy> target =
+ resource_reply_thread_registrar_->GetTargetThreadAndUnregister(
+ reply_params.pp_resource(), reply_params.sequence());
+
+ target->PostTask(
+ FROM_HERE,
+ base::Bind(&DispatchResourceReply, reply_params, nested_msg));
+}
+
+// static
+void PluginMessageFilter::DispatchResourceReply(
+ const ResourceMessageReplyParams& reply_params,
+ const IPC::Message& nested_msg) {
+ ProxyAutoLock lock;
+ Resource* resource = PpapiGlobals::Get()->GetResourceTracker()->GetResource(
+ reply_params.pp_resource());
+ if (!resource) {
+ DVLOG_IF(1, reply_params.sequence() != 0)
+ << "Pepper resource reply message received but the resource doesn't "
+ "exist (probably has been destroyed).";
+ return;
+ }
+ resource->OnReplyReceived(reply_params, nested_msg);
+}
+
} // namespace proxy
} // namespace ppapi
diff --git a/chromium/ppapi/proxy/plugin_message_filter.h b/chromium/ppapi/proxy/plugin_message_filter.h
index 5701a96a09a..646900724a2 100644
--- a/chromium/ppapi/proxy/plugin_message_filter.h
+++ b/chromium/ppapi/proxy/plugin_message_filter.h
@@ -8,26 +8,37 @@
#include <set>
#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_sender.h"
#include "ppapi/c/pp_instance.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
namespace ppapi {
namespace proxy {
+class ResourceMessageReplyParams;
+class ResourceReplyThreadRegistrar;
+
// Listens for messages on the I/O thread of the plugin and handles some of
// them to avoid needing to block on the plugin.
//
// There is one instance of this class for each renderer channel (same as for
// the PluginDispatchers).
-class PluginMessageFilter : public IPC::ChannelProxy::MessageFilter,
- public IPC::Sender {
+class PPAPI_PROXY_EXPORT PluginMessageFilter
+ : public IPC::ChannelProxy::MessageFilter,
+ public IPC::Sender {
public:
- // The input is a pointer to a set that will be used to uniquify PP_Instances
- // across all renderer channels. The same pointer should be passed to each
- // MessageFilter to ensure uniqueness, and the value should outlive this
- // class.
- PluginMessageFilter(std::set<PP_Instance>* seen_instance_ids);
+ // |seen_instance_ids| is a pointer to a set that will be used to uniquify
+ // PP_Instances across all renderer channels. The same pointer should be
+ // passed to each MessageFilter to ensure uniqueness, and the value should
+ // outlive this class. It could be NULL if this filter is for a browser
+ // channel.
+ // |thread_registrar| is used to look up handling threads for resource
+ // reply messages. It shouldn't be NULL.
+ PluginMessageFilter(
+ std::set<PP_Instance>* seen_instance_ids,
+ scoped_refptr<ResourceReplyThreadRegistrar> thread_registrar);
virtual ~PluginMessageFilter();
// MessageFilter implementation.
@@ -38,14 +49,30 @@ class PluginMessageFilter : public IPC::ChannelProxy::MessageFilter,
// IPC::Sender implementation.
virtual bool Send(IPC::Message* msg) OVERRIDE;
+ // Simulates an incoming resource reply that is handled on the calling thread.
+ // For testing only.
+ static void DispatchResourceReplyForTest(
+ const ResourceMessageReplyParams& reply_params,
+ const IPC::Message& nested_msg);
+
private:
void OnMsgReserveInstanceId(PP_Instance instance, bool* usable);
+ void OnMsgResourceReply(const ResourceMessageReplyParams& reply_params,
+ const IPC::Message& nested_msg);
- // All instance IDs every queried by any renderer on this plugin. This is
- // used to make sure that new instance IDs are unique. This is a non-owning
- // pointer, it will be managed by the later that creates this class.
+ // Dispatches the given resource reply to the appropriate resource in the
+ // plugin process.
+ static void DispatchResourceReply(
+ const ResourceMessageReplyParams& reply_params,
+ const IPC::Message& nested_msg);
+
+ // All instance IDs ever queried by any renderer on this plugin. This is used
+ // to make sure that new instance IDs are unique. This is a non-owning
+ // pointer. It is managed by PluginDispatcher::PluginDelegate.
std::set<PP_Instance>* seen_instance_ids_;
+ scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_;
+
// The IPC channel to the renderer. May be NULL if we're not currently
// attached as a filter.
IPC::Channel* channel_;
diff --git a/chromium/ppapi/proxy/plugin_resource.cc b/chromium/ppapi/proxy/plugin_resource.cc
index c450f3c29af..23094fe8444 100644
--- a/chromium/ppapi/proxy/plugin_resource.cc
+++ b/chromium/ppapi/proxy/plugin_resource.cc
@@ -6,7 +6,9 @@
#include <limits>
+#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
namespace ppapi {
namespace proxy {
@@ -16,7 +18,10 @@ PluginResource::PluginResource(Connection connection, PP_Instance instance)
connection_(connection),
next_sequence_number_(1),
sent_create_to_browser_(false),
- sent_create_to_renderer_(false) {
+ sent_create_to_renderer_(false),
+ resource_reply_thread_registrar_(
+ PpapiGlobals::Get()->IsPluginGlobals() ?
+ PluginGlobals::Get()->resource_reply_thread_registrar() : NULL) {
}
PluginResource::~PluginResource() {
@@ -28,6 +33,9 @@ PluginResource::~PluginResource() {
connection_.renderer_sender->Send(
new PpapiHostMsg_ResourceDestroyed(pp_resource()));
}
+
+ if (resource_reply_thread_registrar_)
+ resource_reply_thread_registrar_->Unregister(pp_resource());
}
void PluginResource::OnReplyReceived(
@@ -115,7 +123,7 @@ bool PluginResource::SendResourceCall(
const IPC::Message& nested_msg) {
// For in-process plugins, we need to send the routing ID with the request.
// The browser then uses that routing ID when sending the reply so it will be
- // routed back to the correct RenderViewImpl.
+ // routed back to the correct RenderFrameImpl.
if (dest == BROWSER && connection_.in_process) {
return GetSender(dest)->Send(new PpapiHostMsg_InProcessResourceCall(
connection_.browser_sender_routing_id,
diff --git a/chromium/ppapi/proxy/plugin_resource.h b/chromium/ppapi/proxy/plugin_resource.h
index 9448326d55c..e6d3065d76c 100644
--- a/chromium/ppapi/proxy/plugin_resource.h
+++ b/chromium/ppapi/proxy/plugin_resource.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_sender.h"
#include "ppapi/c/pp_errors.h"
@@ -17,8 +18,9 @@
#include "ppapi/proxy/ppapi_message_utils.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/proxy/resource_message_params.h"
+#include "ppapi/proxy/resource_reply_thread_registrar.h"
#include "ppapi/shared_impl/resource.h"
-
+#include "ppapi/shared_impl/tracked_callback.h"
namespace ppapi {
namespace proxy {
@@ -99,6 +101,23 @@ class PPAPI_PROXY_EXPORT PluginResource : public Resource {
const IPC::Message& msg,
const CallbackType& callback);
+ // Comparing with the previous Call() method, this method takes
+ // |reply_thread_hint| as a hint to determine which thread to handle the reply
+ // message.
+ //
+ // If |reply_thread_hint| is non-blocking, the reply message will be handled
+ // on the target thread of the callback; otherwise, it will be handled on the
+ // main thread.
+ //
+ // If handling a reply message will cause a TrackedCallback to be run, it is
+ // recommended to use this version of Call(). It eliminates unnecessary
+ // thread switching and therefore has better performance.
+ template<typename ReplyMsgClass, typename CallbackType>
+ int32_t Call(Destination dest,
+ const IPC::Message& msg,
+ const CallbackType& callback,
+ scoped_refptr<TrackedCallback> reply_thread_hint);
+
// Calls the browser/renderer with sync messages. Returns the pepper error
// code from the call.
// |ReplyMsgClass| is the type of the reply message that is expected. If it
@@ -159,6 +178,8 @@ class PPAPI_PROXY_EXPORT PluginResource : public Resource {
CallbackMap;
CallbackMap callbacks_;
+ scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_;
+
DISALLOW_COPY_AND_ASSIGN(PluginResource);
};
@@ -166,6 +187,15 @@ template<typename ReplyMsgClass, typename CallbackType>
int32_t PluginResource::Call(Destination dest,
const IPC::Message& msg,
const CallbackType& callback) {
+ return Call<ReplyMsgClass>(dest, msg, callback, NULL);
+}
+
+template<typename ReplyMsgClass, typename CallbackType>
+int32_t PluginResource::Call(
+ Destination dest,
+ const IPC::Message& msg,
+ const CallbackType& callback,
+ scoped_refptr<TrackedCallback> reply_thread_hint) {
TRACE_EVENT2("ppapi proxy", "PluginResource::Call",
"Class", IPC_MESSAGE_ID_CLASS(msg.type()),
"Line", IPC_MESSAGE_ID_LINE(msg.type()));
@@ -176,6 +206,11 @@ int32_t PluginResource::Call(Destination dest,
new PluginResourceCallback<ReplyMsgClass, CallbackType>(callback));
callbacks_.insert(std::make_pair(params.sequence(), plugin_callback));
params.set_has_callback();
+
+ if (resource_reply_thread_registrar_) {
+ resource_reply_thread_registrar_->Register(
+ pp_resource(), params.sequence(), reply_thread_hint);
+ }
SendResourceCall(dest, params, msg);
return params.sequence();
}
diff --git a/chromium/ppapi/proxy/plugin_resource_var.cc b/chromium/ppapi/proxy/plugin_resource_var.cc
index 0ccff749e4d..be4eec5b674 100644
--- a/chromium/ppapi/proxy/plugin_resource_var.cc
+++ b/chromium/ppapi/proxy/plugin_resource_var.cc
@@ -10,7 +10,7 @@ PluginResourceVar::PluginResourceVar(ppapi::Resource* resource)
: resource_(resource) {}
PP_Resource PluginResourceVar::GetPPResource() const {
- return resource_->pp_resource();
+ return resource_ ? resource_->pp_resource() : 0;
}
bool PluginResourceVar::IsPending() const {
diff --git a/chromium/ppapi/proxy/plugin_resource_var.h b/chromium/ppapi/proxy/plugin_resource_var.h
index b02718b6a9f..42be66d219e 100644
--- a/chromium/ppapi/proxy/plugin_resource_var.h
+++ b/chromium/ppapi/proxy/plugin_resource_var.h
@@ -31,6 +31,7 @@ class PPAPI_PROXY_EXPORT PluginResourceVar : public ppapi::ResourceVar {
virtual ~PluginResourceVar();
private:
+ // If NULL, this represents the PP_Resource 0.
scoped_refptr<ppapi::Resource> resource_;
DISALLOW_COPY_AND_ASSIGN(PluginResourceVar);
diff --git a/chromium/ppapi/proxy/plugin_var_tracker.cc b/chromium/ppapi/proxy/plugin_var_tracker.cc
index d2a4d74d0e3..a9cbd9c7a62 100644
--- a/chromium/ppapi/proxy/plugin_var_tracker.cc
+++ b/chromium/ppapi/proxy/plugin_var_tracker.cc
@@ -6,10 +6,13 @@
#include "base/memory/ref_counted.h"
#include "base/memory/singleton.h"
+#include "ipc/ipc_message.h"
#include "ppapi/c/dev/ppp_class_deprecated.h"
#include "ppapi/c/ppb_var.h"
+#include "ppapi/proxy/file_system_resource.h"
#include "ppapi/proxy/plugin_array_buffer_var.h"
#include "ppapi/proxy/plugin_dispatcher.h"
+#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/plugin_resource_var.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/proxy_object_var.h"
@@ -22,6 +25,16 @@
namespace ppapi {
namespace proxy {
+namespace {
+
+Connection GetConnectionForInstance(PP_Instance instance) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
+ DCHECK(dispatcher);
+ return Connection(PluginGlobals::Get()->GetBrowserSender(), dispatcher);
+}
+
+} // namespace
+
PluginVarTracker::HostVar::HostVar(PluginDispatcher* d, int32 i)
: dispatcher(d),
host_object_id(i) {
@@ -154,9 +167,49 @@ void PluginVarTracker::ReleaseHostObject(PluginDispatcher* dispatcher,
ReleaseVar(found->second);
}
+PP_Var PluginVarTracker::MakeResourcePPVarFromMessage(
+ PP_Instance instance,
+ const IPC::Message& creation_message,
+ int pending_renderer_id,
+ int pending_browser_id) {
+ DCHECK(pending_renderer_id);
+ DCHECK(pending_browser_id);
+ switch (creation_message.type()) {
+ case PpapiPluginMsg_FileSystem_CreateFromPendingHost::ID: {
+ PP_FileSystemType file_system_type;
+ if (!UnpackMessage<PpapiPluginMsg_FileSystem_CreateFromPendingHost>(
+ creation_message, &file_system_type)) {
+ NOTREACHED() << "Invalid message of type "
+ "PpapiPluginMsg_FileSystem_CreateFromPendingHost";
+ return PP_MakeNull();
+ }
+ // Create a plugin-side resource and attach it to the host resource.
+ // Note: This only makes sense when the plugin is out of process (which
+ // should always be true when passing resource vars).
+ PP_Resource pp_resource =
+ (new FileSystemResource(GetConnectionForInstance(instance),
+ instance,
+ pending_renderer_id,
+ pending_browser_id,
+ file_system_type))->GetReference();
+ return MakeResourcePPVar(pp_resource);
+ }
+ default: {
+ NOTREACHED() << "Creation message has unexpected type "
+ << creation_message.type();
+ return PP_MakeNull();
+ }
+ }
+}
+
ResourceVar* PluginVarTracker::MakeResourceVar(PP_Resource pp_resource) {
+ // The resource 0 returns a null resource var.
+ if (!pp_resource)
+ return new PluginResourceVar();
+
ResourceTracker* resource_tracker = PpapiGlobals::Get()->GetResourceTracker();
ppapi::Resource* resource = resource_tracker->GetResource(pp_resource);
+ // A non-existant resource other than 0 returns NULL.
if (!resource)
return NULL;
return new PluginResourceVar(resource);
@@ -270,9 +323,11 @@ int32 PluginVarTracker::AddVarInternal(Var* var, AddVarRefMode mode) {
ProxyObjectVar* proxy_object = var->AsProxyObjectVar();
if (proxy_object) {
HostVar host_var(proxy_object->dispatcher(), proxy_object->host_var_id());
- DCHECK(host_var_to_plugin_var_.find(host_var) ==
- host_var_to_plugin_var_.end()); // Adding an object twice, use
- // FindOrMakePluginVarFromHostVar.
+ // TODO(teravest): Change to DCHECK when http://crbug.com/276347 is
+ // resolved.
+ CHECK(host_var_to_plugin_var_.find(host_var) ==
+ host_var_to_plugin_var_.end()); // Adding an object twice, use
+ // FindOrMakePluginVarFromHostVar.
host_var_to_plugin_var_[host_var] = new_id;
}
return new_id;
@@ -394,7 +449,10 @@ scoped_refptr<ProxyObjectVar> PluginVarTracker::FindOrMakePluginVarFromHostVar(
// Have this host var, look up the object.
VarMap::iterator ret = live_vars_.find(found->second);
- DCHECK(ret != live_vars_.end());
+
+ // We CHECK here because we currently don't fall back sanely.
+ // This may be involved in a NULL dereference. http://crbug.com/276347
+ CHECK(ret != live_vars_.end());
// All objects should be proxy objects.
DCHECK(ret->second.var->AsProxyObjectVar());
diff --git a/chromium/ppapi/proxy/plugin_var_tracker.h b/chromium/ppapi/proxy/plugin_var_tracker.h
index 126c8fcac59..03a9e5e412b 100644
--- a/chromium/ppapi/proxy/plugin_var_tracker.h
+++ b/chromium/ppapi/proxy/plugin_var_tracker.h
@@ -59,6 +59,11 @@ class PPAPI_PROXY_EXPORT PluginVarTracker : public VarTracker {
const PP_Var& host_object);
// VarTracker public overrides.
+ virtual PP_Var MakeResourcePPVarFromMessage(
+ PP_Instance instance,
+ const IPC::Message& creation_message,
+ int pending_renderer_id,
+ int pending_browser_id) OVERRIDE;
virtual ResourceVar* MakeResourceVar(PP_Resource pp_resource) OVERRIDE;
virtual void DidDeleteInstance(PP_Instance instance) OVERRIDE;
virtual int TrackSharedMemoryHandle(PP_Instance instance,
diff --git a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc
index 8ca17e442d1..a6da210795d 100644
--- a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc
+++ b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.cc
@@ -8,6 +8,7 @@
#include "ppapi/proxy/proxy_channel.h"
#include "ppapi/shared_impl/api_id.h"
#include "ppapi/shared_impl/host_resource.h"
+#include "ppapi/shared_impl/proxy_lock.h"
namespace ppapi {
namespace proxy {
@@ -29,32 +30,6 @@ PpapiCommandBufferProxy::~PpapiCommandBufferProxy() {
}
}
-void PpapiCommandBufferProxy::ReportChannelError() {
- if (!channel_error_callback_.is_null()) {
- channel_error_callback_.Run();
- channel_error_callback_.Reset();
- }
-}
-
-int PpapiCommandBufferProxy::GetRouteID() const {
- NOTIMPLEMENTED();
- return 0;
-}
-
-bool PpapiCommandBufferProxy::Echo(const base::Closure& callback) {
- return false;
-}
-
-bool PpapiCommandBufferProxy::ProduceFrontBuffer(const gpu::Mailbox& mailbox) {
- NOTIMPLEMENTED();
- return false;
-}
-
-void PpapiCommandBufferProxy::SetChannelErrorCallback(
- const base::Closure& callback) {
- channel_error_callback_ = callback;
-}
-
bool PpapiCommandBufferProxy::Initialize() {
return true;
}
@@ -74,14 +49,12 @@ gpu::CommandBuffer::State PpapiCommandBufferProxy::GetState() {
}
gpu::CommandBuffer::State PpapiCommandBufferProxy::GetLastState() {
- // Note: The locking command buffer wrapper does not take a global lock before
- // calling this function.
+ ppapi::ProxyLock::AssertAcquiredDebugOnly();
return last_state_;
}
int32 PpapiCommandBufferProxy::GetLastToken() {
- // Note: The locking command buffer wrapper does not take a global lock before
- // calling this function.
+ ppapi::ProxyLock::AssertAcquiredDebugOnly();
return last_state_.token;
}
@@ -166,6 +139,10 @@ void PpapiCommandBufferProxy::DestroyTransferBuffer(int32 id) {
ppapi::API_ID_PPB_GRAPHICS_3D, resource_, id));
}
+void PpapiCommandBufferProxy::Echo(const base::Closure& callback) {
+ NOTREACHED();
+}
+
gpu::Buffer PpapiCommandBufferProxy::GetTransferBuffer(int32 id) {
if (last_state_.error != gpu::error::kNoError)
return gpu::Buffer();
@@ -230,6 +207,53 @@ uint32 PpapiCommandBufferProxy::InsertSyncPoint() {
return sync_point;
}
+void PpapiCommandBufferProxy::SignalSyncPoint(uint32 sync_point,
+ const base::Closure& callback) {
+ NOTREACHED();
+}
+
+void PpapiCommandBufferProxy::SignalQuery(uint32 query,
+ const base::Closure& callback) {
+ NOTREACHED();
+}
+
+void PpapiCommandBufferProxy::SetSurfaceVisible(bool visible) {
+ NOTREACHED();
+}
+
+void PpapiCommandBufferProxy::SendManagedMemoryStats(
+ const gpu::ManagedMemoryStats& stats) {
+ NOTREACHED();
+}
+
+gpu::Capabilities PpapiCommandBufferProxy::GetCapabilities() {
+ // TODO(boliu): Need to implement this to use cc in Pepper. Tracked in
+ // crbug.com/325391.
+ return gpu::Capabilities();
+}
+
+gfx::GpuMemoryBuffer* PpapiCommandBufferProxy::CreateGpuMemoryBuffer(
+ size_t width,
+ size_t height,
+ unsigned internalformat,
+ int32* id) {
+ NOTREACHED();
+ return NULL;
+}
+
+void PpapiCommandBufferProxy::DestroyGpuMemoryBuffer(int32 id) {
+ NOTREACHED();
+}
+
+bool PpapiCommandBufferProxy::GenerateMailboxNames(
+ unsigned num, std::vector<gpu::Mailbox>* names) {
+ // TODO(piman): implement this so we can expose mailboxes to pepper
+ // eventually.
+ NOTREACHED();
+ return false;
+}
+
+
bool PpapiCommandBufferProxy::Send(IPC::Message* msg) {
DCHECK(last_state_.error == gpu::error::kNoError);
diff --git a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h
index b5c2c93081c..16809bdfea9 100644
--- a/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h
+++ b/chromium/ppapi/proxy/ppapi_command_buffer_proxy.h
@@ -8,7 +8,7 @@
#include "base/callback.h"
#include "base/containers/hash_tables.h"
#include "gpu/command_buffer/common/command_buffer.h"
-#include "gpu/ipc/command_buffer_proxy.h"
+#include "gpu/command_buffer/common/gpu_control.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/shared_impl/host_resource.h"
@@ -21,36 +21,49 @@ namespace proxy {
class ProxyChannel;
-class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public CommandBufferProxy {
+class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer,
+ public gpu::GpuControl {
public:
PpapiCommandBufferProxy(const HostResource& resource,
ProxyChannel* channel);
virtual ~PpapiCommandBufferProxy();
- void ReportChannelError();
-
- // CommandBufferProxy implementation:
- virtual int GetRouteID() const OVERRIDE;
- virtual bool Echo(const base::Closure& callback) OVERRIDE;
- virtual bool ProduceFrontBuffer(const gpu::Mailbox& mailbox) OVERRIDE;
- virtual void SetChannelErrorCallback(const base::Closure& callback) OVERRIDE;
-
// gpu::CommandBuffer implementation:
- virtual bool Initialize();
- virtual State GetState();
- virtual State GetLastState();
- virtual int32 GetLastToken();
- virtual void Flush(int32 put_offset);
- virtual State FlushSync(int32 put_offset, int32 last_known_get);
- virtual void SetGetBuffer(int32 transfer_buffer_id);
- virtual void SetGetOffset(int32 get_offset);
- virtual gpu::Buffer CreateTransferBuffer(size_t size, int32* id);
- virtual void DestroyTransferBuffer(int32 id);
- virtual gpu::Buffer GetTransferBuffer(int32 id);
- virtual void SetToken(int32 token);
- virtual void SetParseError(gpu::error::Error error);
- virtual void SetContextLostReason(gpu::error::ContextLostReason reason);
- virtual uint32 InsertSyncPoint();
+ virtual bool Initialize() OVERRIDE;
+ virtual State GetState() OVERRIDE;
+ virtual State GetLastState() OVERRIDE;
+ virtual int32 GetLastToken() OVERRIDE;
+ virtual void Flush(int32 put_offset) OVERRIDE;
+ virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE;
+ virtual void SetGetBuffer(int32 transfer_buffer_id) OVERRIDE;
+ virtual void SetGetOffset(int32 get_offset) OVERRIDE;
+ virtual gpu::Buffer CreateTransferBuffer(size_t size, int32* id) OVERRIDE;
+ virtual void DestroyTransferBuffer(int32 id) OVERRIDE;
+ virtual gpu::Buffer GetTransferBuffer(int32 id) OVERRIDE;
+ virtual void SetToken(int32 token) OVERRIDE;
+ virtual void SetParseError(gpu::error::Error error) OVERRIDE;
+ virtual void SetContextLostReason(gpu::error::ContextLostReason reason)
+ OVERRIDE;
+
+ // gpu::GpuControl implementation:
+ virtual gpu::Capabilities GetCapabilities() OVERRIDE;
+ virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(
+ size_t width,
+ size_t height,
+ unsigned internalformat,
+ int32* id) OVERRIDE;
+ virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE;
+ virtual bool GenerateMailboxNames(unsigned num,
+ std::vector<gpu::Mailbox>* names) OVERRIDE;
+ virtual uint32 InsertSyncPoint() OVERRIDE;
+ virtual void SignalSyncPoint(uint32 sync_point,
+ const base::Closure& callback) OVERRIDE;
+ virtual void SignalQuery(uint32 query,
+ const base::Closure& callback) OVERRIDE;
+ virtual void SetSurfaceVisible(bool visible) OVERRIDE;
+ virtual void SendManagedMemoryStats(const gpu::ManagedMemoryStats& stats)
+ OVERRIDE;
+ virtual void Echo(const base::Closure& callback) OVERRIDE;
private:
bool Send(IPC::Message* msg);
diff --git a/chromium/ppapi/proxy/ppapi_messages.h b/chromium/ppapi/proxy/ppapi_messages.h
index 60cc37fafdf..4b4fed8aef4 100644
--- a/chromium/ppapi/proxy/ppapi_messages.h
+++ b/chromium/ppapi/proxy/ppapi_messages.h
@@ -21,6 +21,7 @@
#include "ipc/ipc_platform_file.h"
#include "ppapi/c/dev/pp_video_capture_dev.h"
#include "ppapi/c/dev/pp_video_dev.h"
+#include "ppapi/c/dev/ppb_graphics_2d_dev.h"
#include "ppapi/c/dev/ppb_truetype_font_dev.h"
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/dev/ppp_printing_dev.h"
@@ -42,6 +43,7 @@
#include "ppapi/c/private/pp_private_font_charset.h"
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/c/private/ppb_host_resolver_private.h"
+#include "ppapi/c/private/ppb_isolated_file_system_private.h"
#include "ppapi/c/private/ppb_net_address_private.h"
#include "ppapi/c/private/ppb_pdf.h"
#include "ppapi/c/private/ppb_talk_private.h"
@@ -80,14 +82,18 @@ IPC_ENUM_TRAITS_MAX_VALUE(ppapi::TCPSocketVersion,
IPC_ENUM_TRAITS(PP_AudioSampleRate)
IPC_ENUM_TRAITS(PP_DeviceType_Dev)
IPC_ENUM_TRAITS(PP_DecryptorStreamType)
-IPC_ENUM_TRAITS(PP_FileSystemType)
-IPC_ENUM_TRAITS(PP_FileType)
+IPC_ENUM_TRAITS_MAX_VALUE(PP_FileSystemType, PP_FILESYSTEMTYPE_ISOLATED)
+IPC_ENUM_TRAITS_MAX_VALUE(PP_FileType, PP_FILETYPE_OTHER)
IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_Permission)
IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_SettingType)
IPC_ENUM_TRAITS(PP_FlashSetting)
+IPC_ENUM_TRAITS_MAX_VALUE(PP_Graphics2D_Dev_ResizeMode,
+ PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH)
IPC_ENUM_TRAITS(PP_ImageDataFormat)
IPC_ENUM_TRAITS(PP_InputEvent_MouseButton)
IPC_ENUM_TRAITS(PP_InputEvent_Type)
+IPC_ENUM_TRAITS_MAX_VALUE(PP_IsolatedFileSystemType_Private,
+ PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE)
IPC_ENUM_TRAITS_MAX_VALUE(PP_NetAddressFamily_Private,
PP_NETADDRESSFAMILY_PRIVATE_IPV6)
IPC_ENUM_TRAITS_MAX_VALUE(PP_NetworkList_State, PP_NETWORKLIST_STATE_UP)
@@ -194,6 +200,15 @@ IPC_STRUCT_TRAITS_BEGIN(PP_URLComponents_Dev)
IPC_STRUCT_TRAITS_MEMBER(ref)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(PP_FileInfo)
+ IPC_STRUCT_TRAITS_MEMBER(size)
+ IPC_STRUCT_TRAITS_MEMBER(type)
+ IPC_STRUCT_TRAITS_MEMBER(system_type)
+ IPC_STRUCT_TRAITS_MEMBER(creation_time)
+ IPC_STRUCT_TRAITS_MEMBER(last_access_time)
+ IPC_STRUCT_TRAITS_MEMBER(last_modified_time)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(ppapi::DeviceRefData)
IPC_STRUCT_TRAITS_MEMBER(type)
IPC_STRUCT_TRAITS_MEMBER(name)
@@ -349,9 +364,10 @@ IPC_STRUCT_TRAITS_END()
// These are from the browser to the plugin.
// Loads the given plugin.
-IPC_MESSAGE_CONTROL2(PpapiMsg_LoadPlugin,
+IPC_MESSAGE_CONTROL3(PpapiMsg_LoadPlugin,
base::FilePath /* path */,
- ppapi::PpapiPermissions /* permissions */)
+ ppapi::PpapiPermissions /* permissions */,
+ bool /* supports_dev_channel */)
// Creates a channel to talk to a renderer. The plugin will respond with
// PpapiHostMsg_ChannelCreated.
@@ -490,12 +506,6 @@ IPC_MESSAGE_ROUTED4(PpapiMsg_PPBAudio_NotifyAudioStreamCreated,
ppapi::proxy::SerializedHandle /* socket_handle */,
ppapi::proxy::SerializedHandle /* handle */)
-// PPB_FileSystem.
-IPC_MESSAGE_ROUTED2(
- PpapiMsg_PPBFileSystem_OpenComplete,
- ppapi::HostResource /* filesystem */,
- int32_t /* result */)
-
// PPB_Graphics3D.
IPC_MESSAGE_ROUTED2(PpapiMsg_PPBGraphics3D_SwapBuffersACK,
ppapi::HostResource /* graphics_3d */,
@@ -636,22 +646,21 @@ IPC_MESSAGE_ROUTED3(
int32_t /* result */)
// PPP_ContentDecryptor_Dev
-IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_Initialize,
+IPC_MESSAGE_ROUTED2(PpapiMsg_PPPContentDecryptor_Initialize,
PP_Instance /* instance */,
- ppapi::proxy::SerializedVar /* key_system, String */,
- bool /* can_challenge_platform */)
-IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_GenerateKeyRequest,
+ ppapi::proxy::SerializedVar /* key_system, String */)
+IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_CreateSession,
PP_Instance /* instance */,
+ uint32_t /* session_id */,
ppapi::proxy::SerializedVar /* type, String */,
ppapi::proxy::SerializedVar /* init_data, ArrayBuffer */)
-IPC_MESSAGE_ROUTED4(PpapiMsg_PPPContentDecryptor_AddKey,
+IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_UpdateSession,
PP_Instance /* instance */,
- ppapi::proxy::SerializedVar /* session_id, String */,
- ppapi::proxy::SerializedVar /* key, ArrayBuffer */,
- ppapi::proxy::SerializedVar /* init_data, ArrayBuffer */)
-IPC_MESSAGE_ROUTED2(PpapiMsg_PPPContentDecryptor_CancelKeyRequest,
+ uint32_t /* session_id */,
+ ppapi::proxy::SerializedVar /* response, ArrayBuffer */)
+IPC_MESSAGE_ROUTED2(PpapiMsg_PPPContentDecryptor_ReleaseSession,
PP_Instance /* instance */,
- ppapi::proxy::SerializedVar /* session_id, String */)
+ uint32_t /* session_id */)
IPC_MESSAGE_ROUTED3(PpapiMsg_PPPContentDecryptor_Decrypt,
PP_Instance /* instance */,
ppapi::proxy::PPPDecryptor_Buffer /* buffer */,
@@ -974,20 +983,24 @@ IPC_SYNC_MESSAGE_ROUTED2_2(
ppapi::proxy::SerializedHandle /* result_shm_handle */)
// PPB_ContentDecryptor_Dev messages handled in PPB_Instance_Proxy.
-IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_KeyAdded,
+IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_SessionCreated,
PP_Instance /* instance */,
- ppapi::proxy::SerializedVar /* key_system, String */,
- ppapi::proxy::SerializedVar /* session_id, String */)
-IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBInstance_KeyMessage,
+ uint32_t /* session_id */,
+ ppapi::proxy::SerializedVar /* web_session_id, String */)
+IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBInstance_SessionMessage,
PP_Instance /* instance */,
- ppapi::proxy::SerializedVar /* key_system, String */,
- ppapi::proxy::SerializedVar /* session_id, String */,
+ uint32_t /* session_id */,
ppapi::proxy::SerializedVar /* message, ArrayBuffer */,
- ppapi::proxy::SerializedVar /* default_url, String */)
-IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBInstance_KeyError,
+ ppapi::proxy::SerializedVar /* destination_url, String */)
+IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBInstance_SessionReady,
+ PP_Instance /* instance */,
+ uint32_t /* session_id */)
+IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBInstance_SessionClosed,
PP_Instance /* instance */,
- ppapi::proxy::SerializedVar /* key_system, String */,
- ppapi::proxy::SerializedVar /* session_id, String */,
+ uint32_t /* session_id */)
+IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBInstance_SessionError,
+ PP_Instance /* instance */,
+ uint32_t /* session_id */,
int32_t /* media_error */,
int32_t /* system_code */)
IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBInstance_DeliverBlock,
@@ -1194,12 +1207,6 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_ExtensionsCommon_Call,
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_ExtensionsCommon_CallReply,
base::ListValue /* output */)
-// Ext_CrxFileSystem
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_Ext_CrxFileSystem_Create)
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_Ext_CrxFileSystem_BrowserOpen)
-IPC_MESSAGE_CONTROL1(PpapiPluginMsg_Ext_CrxFileSystem_BrowserOpenReply,
- std::string /* fsid */)
-
// File chooser.
IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileChooser_Create)
IPC_MESSAGE_CONTROL4(PpapiHostMsg_FileChooser_Show,
@@ -1226,14 +1233,6 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileIO_Write,
IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileIO_SetLength,
int64_t /* length */)
IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_Flush)
-IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileIO_WillWrite,
- int64_t /* offset */,
- int32_t /* bytes_to_write */)
-IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileIO_WillSetLength,
- int64_t /* length */)
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_GetOSFileDescriptor)
-IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FileIO_GetOSFileDescriptorReply,
- int32_t /* file descriptor */)
IPC_MESSAGE_CONTROL0(PpapiHostMsg_FileIO_RequestOSFileHandle)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileIO_RequestOSFileHandleReply)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileIO_GeneralReply)
@@ -1302,9 +1301,20 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_Create,
IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_Open,
int64_t /* expected_size */)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileSystem_OpenReply)
-IPC_MESSAGE_CONTROL1(PpapiHostMsg_FileSystem_InitIsolatedFileSystem,
- std::string /* fsid */)
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileSystem_InitIsolatedFileSystem,
+ std::string /* fsid */,
+ PP_IsolatedFileSystemType_Private /* type */)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_FileSystem_InitIsolatedFileSystemReply)
+// Passed from renderer to browser. Creates an already-open file system with a
+// given |root_url| and |file_system_type|.
+IPC_MESSAGE_CONTROL2(PpapiHostMsg_FileSystem_CreateFromRenderer,
+ std::string /* root_url */,
+ PP_FileSystemType /* file_system_type */)
+// Nested within a ResourceVar for file systems being passed from the renderer
+// to the plugin. Creates an already-open file system resource on the plugin,
+// linked to the existing resource host given in the ResourceVar.
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FileSystem_CreateFromPendingHost,
+ PP_FileSystemType /* file_system_type */)
// Flash DRM ------------------------------------------------------------------
IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDRM_Create)
@@ -1330,6 +1340,14 @@ IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDRM_GetVoucherFile)
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashDRM_GetVoucherFileReply,
ppapi::FileRefCreateInfo /* file_info */)
+// Requests a value indicating whether the monitor on which the instance is
+// displayed is external.
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_FlashDRM_MonitorIsExternal)
+// Reply message for MonitorIsExternal which contains the value indicating if
+// the monitor is external.
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashDRM_MonitorIsExternalReply,
+ PP_Bool /* is_external */)
+
// Gamepad.
IPC_MESSAGE_CONTROL0(PpapiHostMsg_Gamepad_Create)
@@ -1359,9 +1377,14 @@ IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_ReplaceContents,
ppapi::HostResource /* image_data */)
IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_Dev_SetScale,
float /* scale */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetOffset,
+ PP_Point /* offset */)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetResizeMode,
+ PP_Graphics2D_Dev_ResizeMode /* resize_mode */)
// Graphics2D, plugin -> host -> plugin
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_Graphics2D_Flush)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_Flush,
+ ppapi::ViewData /* view_data */)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Graphics2D_FlushAck)
IPC_MESSAGE_CONTROL2(PpapiHostMsg_Graphics2D_ReadImageData,
@@ -1369,13 +1392,19 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_Graphics2D_ReadImageData,
PP_Point /* top_left */)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Graphics2D_ReadImageDataAck)
+// IsolatedFileSystem
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_IsolatedFileSystem_Create)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_IsolatedFileSystem_BrowserOpen,
+ PP_IsolatedFileSystemType_Private /* type */)
+IPC_MESSAGE_CONTROL1(PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply,
+ std::string /* fsid */)
+
// NetworkMonitor.
IPC_MESSAGE_CONTROL0(PpapiHostMsg_NetworkMonitor_Create)
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_NetworkMonitor_NetworkList,
ppapi::proxy::SerializedNetworkList /* network_list */)
IPC_MESSAGE_CONTROL0(PpapiPluginMsg_NetworkMonitor_Forbidden)
-
// NetworkProxy ----------------------------------------------------------------
IPC_MESSAGE_CONTROL0(PpapiHostMsg_NetworkProxy_Create)
@@ -1433,10 +1462,6 @@ IPC_MESSAGE_CONTROL2(PpapiPluginMsg_HostResolver_ResolveReply,
// Platform Verification -------------------------------------------------------
IPC_MESSAGE_CONTROL0(PpapiHostMsg_PlatformVerification_Create)
-IPC_MESSAGE_CONTROL0(PpapiHostMsg_PlatformVerification_CanChallengePlatform)
-IPC_MESSAGE_CONTROL1(
- PpapiHostMsg_PlatformVerification_CanChallengePlatformReply,
- bool /* can_challenge_platform */)
IPC_MESSAGE_CONTROL2(PpapiHostMsg_PlatformVerification_ChallengePlatform,
std::string /* service_id */,
std::vector<uint8_t> /* challenge */)
@@ -1713,6 +1738,17 @@ IPC_MESSAGE_CONTROL4(PpapiPluginMsg_WebSocket_ClosedReply,
uint16_t /* code */,
std::string /* reason */)
+// OutputProtection -----------------------------------------------------------
+
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_OutputProtection_Create)
+IPC_MESSAGE_CONTROL1(PpapiHostMsg_OutputProtection_EnableProtection,
+ uint32_t /* desired_method_mask */)
+IPC_MESSAGE_CONTROL0(PpapiPluginMsg_OutputProtection_EnableProtectionReply)
+IPC_MESSAGE_CONTROL0(PpapiHostMsg_OutputProtection_QueryStatus)
+IPC_MESSAGE_CONTROL2(PpapiPluginMsg_OutputProtection_QueryStatusReply,
+ uint32_t /* link_mask */,
+ uint32_t /* protection_mask */)
+
#if !defined(OS_NACL) && !defined(NACL_WIN64)
// Audio input.
diff --git a/chromium/ppapi/proxy/ppapi_param_traits.cc b/chromium/ppapi/proxy/ppapi_param_traits.cc
index 5d4345f85aa..5ee0a34397a 100644
--- a/chromium/ppapi/proxy/ppapi_param_traits.cc
+++ b/chromium/ppapi/proxy/ppapi_param_traits.cc
@@ -6,7 +6,6 @@
#include <string.h> // For memcpy
-#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/serialized_var.h"
@@ -98,48 +97,6 @@ bool ParamTraits<PP_Bool>::Read(const Message* m,
void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) {
}
-// PP_FileInfo -------------------------------------------------------------
-
-// static
-void ParamTraits<PP_FileInfo>::Write(Message* m, const param_type& p) {
- ParamTraits<int64_t>::Write(m, p.size);
- ParamTraits<int>::Write(m, static_cast<int>(p.type));
- ParamTraits<int>::Write(m, static_cast<int>(p.system_type));
- ParamTraits<double>::Write(m, p.creation_time);
- ParamTraits<double>::Write(m, p.last_access_time);
- ParamTraits<double>::Write(m, p.last_modified_time);
-}
-
-// static
-bool ParamTraits<PP_FileInfo>::Read(const Message* m, PickleIterator* iter,
- param_type* r) {
- int type, system_type;
- if (!ParamTraits<int64_t>::Read(m, iter, &r->size) ||
- !ParamTraits<int>::Read(m, iter, &type) ||
- !ParamTraits<int>::Read(m, iter, &system_type) ||
- !ParamTraits<double>::Read(m, iter, &r->creation_time) ||
- !ParamTraits<double>::Read(m, iter, &r->last_access_time) ||
- !ParamTraits<double>::Read(m, iter, &r->last_modified_time))
- return false;
- if (type != PP_FILETYPE_REGULAR &&
- type != PP_FILETYPE_DIRECTORY &&
- type != PP_FILETYPE_OTHER)
- return false;
- r->type = static_cast<PP_FileType>(type);
- if (system_type != PP_FILESYSTEMTYPE_INVALID &&
- system_type != PP_FILESYSTEMTYPE_EXTERNAL &&
- system_type != PP_FILESYSTEMTYPE_LOCALPERSISTENT &&
- system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY &&
- system_type != PP_FILESYSTEMTYPE_ISOLATED)
- return false;
- r->system_type = static_cast<PP_FileSystemType>(system_type);
- return true;
-}
-
-// static
-void ParamTraits<PP_FileInfo>::Log(const param_type& p, std::string* l) {
-}
-
// PP_NetAddress_Private -------------------------------------------------------
// static
diff --git a/chromium/ppapi/proxy/ppapi_param_traits.h b/chromium/ppapi/proxy/ppapi_param_traits.h
index b56ec3e3d4b..3bf5fb6b696 100644
--- a/chromium/ppapi/proxy/ppapi_param_traits.h
+++ b/chromium/ppapi/proxy/ppapi_param_traits.h
@@ -19,7 +19,6 @@
#include "ppapi/shared_impl/ppapi_permissions.h"
#include "ppapi/shared_impl/socket_option_data.h"
-struct PP_FileInfo;
struct PP_NetAddress_Private;
namespace ppapi {
@@ -51,14 +50,6 @@ struct PPAPI_PROXY_EXPORT ParamTraits<PP_Bool> {
static void Log(const param_type& p, std::string* l);
};
-template<>
-struct PPAPI_PROXY_EXPORT ParamTraits<PP_FileInfo> {
- typedef PP_FileInfo param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, PickleIterator* iter, param_type* r);
- static void Log(const param_type& p, std::string* l);
-};
-
template <>
struct PPAPI_PROXY_EXPORT ParamTraits<PP_NetAddress_Private> {
typedef PP_NetAddress_Private param_type;
diff --git a/chromium/ppapi/proxy/ppb_audio_proxy.cc b/chromium/ppapi/proxy/ppb_audio_proxy.cc
index 49ed0afb2d2..58f5abc0d41 100644
--- a/chromium/ppapi/proxy/ppb_audio_proxy.cc
+++ b/chromium/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/chromium/ppapi/proxy/ppb_graphics_3d_proxy.cc b/chromium/ppapi/proxy/ppb_graphics_3d_proxy.cc
index 5fb1d1098c8..02e06f76b8f 100644
--- a/chromium/ppapi/proxy/ppb_graphics_3d_proxy.cc
+++ b/chromium/ppapi/proxy/ppb_graphics_3d_proxy.cc
@@ -12,7 +12,6 @@
#include "ppapi/proxy/ppapi_command_buffer_proxy.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/ppapi_globals.h"
-#include "ppapi/shared_impl/proxy_lock.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
@@ -53,132 +52,8 @@ gpu::CommandBuffer::State GetErrorState() {
} // namespace
-// This class just wraps a CommandBuffer and optionally locks around every
-// method. This is used to ensure that we have the Proxy lock any time we enter
-// PpapiCommandBufferProxy.
-//
-// Note, for performance reasons, most of this code is not truly thread
-// safe in the sense of multiple threads concurrently rendering to the same
-// Graphics3D context; this isn't allowed, and will likely either crash or
-// result in undefined behavior. It is assumed that the thread which creates
-// the Graphics3D context will be the thread on which subsequent gl rendering
-// will be done. This is why it is okay to read need_to_lock_ without the lock;
-// it should only ever be read and written on the same thread where the context
-// was created.
-//
-// TODO(nfullagar): At some point, allow multiple threads to concurrently render
-// each to its own context. First step is to allow a single thread (either main
-// thread or background thread) to render to a single Graphics3D context.
-class Graphics3D::LockingCommandBuffer : public gpu::CommandBuffer {
- public:
- explicit LockingCommandBuffer(gpu::CommandBuffer* gpu_command_buffer)
- : gpu_command_buffer_(gpu_command_buffer), need_to_lock_(true) {
- }
- virtual ~LockingCommandBuffer() {
- }
- void set_need_to_lock(bool need_to_lock) { need_to_lock_ = need_to_lock; }
- bool need_to_lock() const { return need_to_lock_; }
-
- private:
- // MaybeLock acquires the proxy lock on construction if and only if
- // need_to_lock is true. If it acquired the lock, it releases it on
- // destruction. If need_to_lock is false, then the lock must already be held.
- struct MaybeLock {
- explicit MaybeLock(bool need_to_lock) : locked_(need_to_lock) {
- if (need_to_lock)
- ppapi::ProxyLock::Acquire();
- else
- ppapi::ProxyLock::AssertAcquired();
- }
- ~MaybeLock() {
- if (locked_)
- ppapi::ProxyLock::Release();
- }
- private:
- bool locked_;
- };
-
- // gpu::CommandBuffer implementation:
- virtual bool Initialize() OVERRIDE {
- MaybeLock lock(need_to_lock_);
- return gpu_command_buffer_->Initialize();
- }
- virtual State GetState() OVERRIDE {
- MaybeLock lock(need_to_lock_);
- return gpu_command_buffer_->GetState();
- }
- virtual State GetLastState() OVERRIDE {
- // During a normal scene, the vast majority of calls are to GetLastState().
- // We don't allow multi-threaded rendering on the same contex, so for
- // performance reasons, avoid the global lock for this entry point. We can
- // get away with this here because the underlying implementation of
- // GetLastState() is trivial and does not involve global or shared state
- // between other contexts.
- // TODO(nfullagar): We can probably skip MaybeLock for other methods, but
- // the performance gain may not be worth it.
- //
- // MaybeLock lock(need_to_lock_);
- return gpu_command_buffer_->GetLastState();
- }
- virtual int32 GetLastToken() OVERRIDE {
- return GetLastState().token;
- }
- virtual void Flush(int32 put_offset) OVERRIDE {
- MaybeLock lock(need_to_lock_);
- gpu_command_buffer_->Flush(put_offset);
- }
- virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE {
- MaybeLock lock(need_to_lock_);
- return gpu_command_buffer_->FlushSync(put_offset, last_known_get);
- }
- virtual void SetGetBuffer(int32 transfer_buffer_id) OVERRIDE {
- MaybeLock lock(need_to_lock_);
- gpu_command_buffer_->SetGetBuffer(transfer_buffer_id);
- }
- virtual void SetGetOffset(int32 get_offset) OVERRIDE {
- MaybeLock lock(need_to_lock_);
- gpu_command_buffer_->SetGetOffset(get_offset);
- }
- virtual gpu::Buffer CreateTransferBuffer(size_t size,
- int32* id) OVERRIDE {
- MaybeLock lock(need_to_lock_);
- return gpu_command_buffer_->CreateTransferBuffer(size, id);
- }
- virtual void DestroyTransferBuffer(int32 id) OVERRIDE {
- MaybeLock lock(need_to_lock_);
- gpu_command_buffer_->DestroyTransferBuffer(id);
- }
- virtual gpu::Buffer GetTransferBuffer(int32 id) OVERRIDE {
- MaybeLock lock(need_to_lock_);
- return gpu_command_buffer_->GetTransferBuffer(id);
- }
- virtual void SetToken(int32 token) OVERRIDE {
- MaybeLock lock(need_to_lock_);
- gpu_command_buffer_->SetToken(token);
- }
- virtual void SetParseError(gpu::error::Error error) OVERRIDE {
- MaybeLock lock(need_to_lock_);
- gpu_command_buffer_->SetParseError(error);
- }
- virtual void SetContextLostReason(
- gpu::error::ContextLostReason reason) OVERRIDE {
- MaybeLock lock(need_to_lock_);
- gpu_command_buffer_->SetContextLostReason(reason);
- }
- virtual uint32 InsertSyncPoint() OVERRIDE {
- MaybeLock lock(need_to_lock_);
- return gpu_command_buffer_->InsertSyncPoint();
- }
-
- // Weak pointer - see class Graphics3D for the scopted_ptr.
- gpu::CommandBuffer* gpu_command_buffer_;
-
- bool need_to_lock_;
-};
-
Graphics3D::Graphics3D(const HostResource& resource)
- : PPB_Graphics3D_Shared(resource),
- num_already_locked_calls_(0) {
+ : PPB_Graphics3D_Shared(resource) {
}
Graphics3D::~Graphics3D() {
@@ -192,10 +67,7 @@ bool Graphics3D::Init(gpu::gles2::GLES2Implementation* share_gles2) {
command_buffer_.reset(
new PpapiCommandBufferProxy(host_resource(), dispatcher));
- locking_command_buffer_.reset(
- new LockingCommandBuffer(command_buffer_.get()));
- ScopedNoLocking already_locked(this);
return CreateGLES2Impl(kCommandBufferSize, kTransferBufferSize,
share_gles2);
}
@@ -241,14 +113,14 @@ uint32_t Graphics3D::InsertSyncPoint() {
}
gpu::CommandBuffer* Graphics3D::GetCommandBuffer() {
- return locking_command_buffer_.get();
+ return command_buffer_.get();
}
-int32 Graphics3D::DoSwapBuffers() {
- // gles2_impl()->SwapBuffers() results in CommandBuffer calls, and we already
- // have the proxy lock.
- ScopedNoLocking already_locked(this);
+gpu::GpuControl* Graphics3D::GetGpuControl() {
+ return command_buffer_.get();
+}
+int32 Graphics3D::DoSwapBuffers() {
gles2_impl()->SwapBuffers();
IPC::Message* msg = new PpapiHostMsg_PPBGraphics3D_SwapBuffers(
API_ID_PPB_GRAPHICS_3D, host_resource());
@@ -258,31 +130,6 @@ int32 Graphics3D::DoSwapBuffers() {
return PP_OK_COMPLETIONPENDING;
}
-void Graphics3D::PushAlreadyLocked() {
- ppapi::ProxyLock::AssertAcquired();
- if (!locking_command_buffer_) {
- NOTREACHED();
- return;
- }
- if (num_already_locked_calls_ == 0)
- locking_command_buffer_->set_need_to_lock(false);
- ++num_already_locked_calls_;
-}
-
-void Graphics3D::PopAlreadyLocked() {
- // We must have Pushed before we can Pop.
- DCHECK(!locking_command_buffer_->need_to_lock());
- DCHECK_GT(num_already_locked_calls_, 0);
- ppapi::ProxyLock::AssertAcquired();
- if (!locking_command_buffer_) {
- NOTREACHED();
- return;
- }
- --num_already_locked_calls_;
- if (num_already_locked_calls_ == 0)
- locking_command_buffer_->set_need_to_lock(true);
-}
-
PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
callback_factory_(this) {
diff --git a/chromium/ppapi/proxy/ppb_graphics_3d_proxy.h b/chromium/ppapi/proxy/ppb_graphics_3d_proxy.h
index ffda80c754a..18ba9dd5e3c 100644
--- a/chromium/ppapi/proxy/ppb_graphics_3d_proxy.h
+++ b/chromium/ppapi/proxy/ppb_graphics_3d_proxy.h
@@ -24,6 +24,7 @@ class HostResource;
namespace proxy {
class SerializedHandle;
+class PpapiCommandBufferProxy;
class Graphics3D : public PPB_Graphics3D_Shared {
public:
@@ -48,17 +49,12 @@ class Graphics3D : public PPB_Graphics3D_Shared {
virtual uint32_t InsertSyncPoint() OVERRIDE;
private:
- class LockingCommandBuffer;
-
// PPB_Graphics3D_Shared overrides.
virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE;
+ virtual gpu::GpuControl* GetGpuControl() OVERRIDE;
virtual int32 DoSwapBuffers() OVERRIDE;
- virtual void PushAlreadyLocked() OVERRIDE;
- virtual void PopAlreadyLocked() OVERRIDE;
- int num_already_locked_calls_;
- scoped_ptr<gpu::CommandBuffer> command_buffer_;
- scoped_ptr<LockingCommandBuffer> locking_command_buffer_;
+ scoped_ptr<PpapiCommandBufferProxy> command_buffer_;
DISALLOW_COPY_AND_ASSIGN(Graphics3D);
};
diff --git a/chromium/ppapi/proxy/ppb_image_data_proxy.cc b/chromium/ppapi/proxy/ppb_image_data_proxy.cc
index 0ed3c24a37a..c9d61f9feae 100644
--- a/chromium/ppapi/proxy/ppb_image_data_proxy.cc
+++ b/chromium/ppapi/proxy/ppb_image_data_proxy.cc
@@ -249,15 +249,15 @@ class ImageDataCache {
// Timer callback to expire entries for the given instance.
void OnTimer(PP_Instance instance);
+ typedef std::map<PP_Instance, ImageDataInstanceCache> CacheMap;
+ CacheMap cache_;
+
// This class does timer calls and we don't want to run these outside of the
// scope of the object. Technically, since this class is a leaked static,
// this will never happen and this factory is unnecessary. However, it's
// probably better not to make assumptions about the lifetime of this class.
base::WeakPtrFactory<ImageDataCache> weak_factory_;
- typedef std::map<PP_Instance, ImageDataInstanceCache> CacheMap;
- CacheMap cache_;
-
DISALLOW_COPY_AND_ASSIGN(ImageDataCache);
};
diff --git a/chromium/ppapi/proxy/ppb_instance_proxy.cc b/chromium/ppapi/proxy/ppb_instance_proxy.cc
index fdaa8c47d25..5d0e7ed3eb0 100644
--- a/chromium/ppapi/proxy/ppb_instance_proxy.cc
+++ b/chromium/ppapi/proxy/ppb_instance_proxy.cc
@@ -18,7 +18,6 @@
#include "ppapi/proxy/browser_font_singleton_resource.h"
#include "ppapi/proxy/content_decryptor_private_serializer.h"
#include "ppapi/proxy/enter_proxy.h"
-#include "ppapi/proxy/ext_crx_file_system_private_resource.h"
#include "ppapi/proxy/extensions_common_resource.h"
#include "ppapi/proxy/flash_clipboard_resource.h"
#include "ppapi/proxy/flash_file_resource.h"
@@ -26,6 +25,7 @@
#include "ppapi/proxy/flash_resource.h"
#include "ppapi/proxy/gamepad_resource.h"
#include "ppapi/proxy/host_dispatcher.h"
+#include "ppapi/proxy/isolated_file_system_private_resource.h"
#include "ppapi/proxy/network_proxy_resource.h"
#include "ppapi/proxy/pdf_resource.h"
#include "ppapi/proxy/plugin_dispatcher.h"
@@ -175,12 +175,16 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
OnHostMsgGetPluginInstanceURL)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginReferrerURL,
OnHostMsgGetPluginReferrerURL)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded,
- OnHostMsgKeyAdded)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage,
- OnHostMsgKeyMessage)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError,
- OnHostMsgKeyError)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionCreated,
+ OnHostMsgSessionCreated)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionMessage,
+ OnHostMsgSessionMessage)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionReady,
+ OnHostMsgSessionReady)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionClosed,
+ OnHostMsgSessionClosed)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionError,
+ OnHostMsgSessionError)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock,
OnHostMsgDeliverBlock)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderInitializeDone,
@@ -371,15 +375,16 @@ Resource* PPB_Instance_Proxy::GetSingletonResource(PP_Instance instance,
case BROKER_SINGLETON_ID:
new_singleton = new BrokerResource(connection, instance);
break;
- case CRX_FILESYSTEM_SINGLETON_ID:
- new_singleton = new ExtCrxFileSystemPrivateResource(connection, instance);
- break;
case EXTENSIONS_COMMON_SINGLETON_ID:
new_singleton = new ExtensionsCommonResource(connection, instance);
break;
case GAMEPAD_SINGLETON_ID:
new_singleton = new GamepadResource(connection, instance);
break;
+ case ISOLATED_FILESYSTEM_SINGLETON_ID:
+ new_singleton =
+ new IsolatedFileSystemPrivateResource(connection, instance);
+ break;
case NETWORK_PROXY_SINGLETON_ID:
new_singleton = new NetworkProxyResource(connection, instance);
break;
@@ -537,45 +542,46 @@ PP_Var PPB_Instance_Proxy::GetPluginReferrerURL(
components);
}
-void PPB_Instance_Proxy::KeyAdded(PP_Instance instance,
- PP_Var key_system,
- PP_Var session_id) {
- dispatcher()->Send(
- new PpapiHostMsg_PPBInstance_KeyAdded(
- API_ID_PPB_INSTANCE,
- instance,
- SerializedVarSendInput(dispatcher(), key_system),
- SerializedVarSendInput(dispatcher(), session_id)));
+void PPB_Instance_Proxy::SessionCreated(PP_Instance instance,
+ uint32_t session_id,
+ PP_Var web_session_id) {
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionCreated(
+ API_ID_PPB_INSTANCE,
+ instance,
+ session_id,
+ SerializedVarSendInput(dispatcher(), web_session_id)));
}
-void PPB_Instance_Proxy::KeyMessage(PP_Instance instance,
- PP_Var key_system,
- PP_Var session_id,
- PP_Var message,
- PP_Var default_url) {
- dispatcher()->Send(
- new PpapiHostMsg_PPBInstance_KeyMessage(
- API_ID_PPB_INSTANCE,
- instance,
- SerializedVarSendInput(dispatcher(), key_system),
- SerializedVarSendInput(dispatcher(), session_id),
- SerializedVarSendInput(dispatcher(), message),
- SerializedVarSendInput(dispatcher(), default_url)));
+void PPB_Instance_Proxy::SessionMessage(PP_Instance instance,
+ uint32_t session_id,
+ PP_Var message,
+ PP_Var destination_url) {
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionMessage(
+ API_ID_PPB_INSTANCE,
+ instance,
+ session_id,
+ SerializedVarSendInput(dispatcher(), message),
+ SerializedVarSendInput(dispatcher(), destination_url)));
}
-void PPB_Instance_Proxy::KeyError(PP_Instance instance,
- PP_Var key_system,
- PP_Var session_id,
- int32_t media_error,
- int32_t system_code) {
- dispatcher()->Send(
- new PpapiHostMsg_PPBInstance_KeyError(
- API_ID_PPB_INSTANCE,
- instance,
- SerializedVarSendInput(dispatcher(), key_system),
- SerializedVarSendInput(dispatcher(), session_id),
- media_error,
- system_code));
+void PPB_Instance_Proxy::SessionReady(PP_Instance instance,
+ uint32_t session_id) {
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionReady(
+ API_ID_PPB_INSTANCE, instance, session_id));
+}
+
+void PPB_Instance_Proxy::SessionClosed(PP_Instance instance,
+ uint32_t session_id) {
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionClosed(
+ API_ID_PPB_INSTANCE, instance, session_id));
+}
+
+void PPB_Instance_Proxy::SessionError(PP_Instance instance,
+ uint32_t session_id,
+ int32_t media_error,
+ int32_t system_code) {
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionError(
+ API_ID_PPB_INSTANCE, instance, session_id, media_error, system_code));
}
void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance,
@@ -675,7 +681,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 +695,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 +705,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)
@@ -1042,53 +1048,65 @@ void PPB_Instance_Proxy::OnHostMsgGetPluginReferrerURL(
}
}
-void PPB_Instance_Proxy::OnHostMsgKeyAdded(
+void PPB_Instance_Proxy::OnHostMsgSessionCreated(
PP_Instance instance,
- SerializedVarReceiveInput key_system,
- SerializedVarReceiveInput session_id) {
+ uint32_t session_id,
+ SerializedVarReceiveInput web_session_id) {
if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
return;
EnterInstanceNoLock enter(instance);
if (enter.succeeded()) {
- enter.functions()->KeyAdded(instance,
- key_system.Get(dispatcher()),
- session_id.Get(dispatcher()));
+ enter.functions()->SessionCreated(
+ instance, session_id, web_session_id.Get(dispatcher()));
}
}
-void PPB_Instance_Proxy::OnHostMsgKeyMessage(
+void PPB_Instance_Proxy::OnHostMsgSessionMessage(
PP_Instance instance,
- SerializedVarReceiveInput key_system,
- SerializedVarReceiveInput session_id,
+ uint32_t session_id,
SerializedVarReceiveInput message,
- SerializedVarReceiveInput default_url) {
+ SerializedVarReceiveInput destination_url) {
if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
return;
EnterInstanceNoLock enter(instance);
if (enter.succeeded()) {
- enter.functions()->KeyMessage(instance,
- key_system.Get(dispatcher()),
- session_id.Get(dispatcher()),
- message.Get(dispatcher()),
- default_url.Get(dispatcher()));
+ enter.functions()->SessionMessage(instance,
+ session_id,
+ message.Get(dispatcher()),
+ destination_url.Get(dispatcher()));
}
}
-void PPB_Instance_Proxy::OnHostMsgKeyError(
- PP_Instance instance,
- SerializedVarReceiveInput key_system,
- SerializedVarReceiveInput session_id,
- int32_t media_error,
- int32_t system_error) {
+void PPB_Instance_Proxy::OnHostMsgSessionReady(PP_Instance instance,
+ uint32_t session_id) {
+ if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+ return;
+ EnterInstanceNoLock enter(instance);
+ if (enter.succeeded()) {
+ enter.functions()->SessionReady(instance, session_id);
+ }
+}
+
+void PPB_Instance_Proxy::OnHostMsgSessionClosed(PP_Instance instance,
+ uint32_t session_id) {
if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
return;
EnterInstanceNoLock enter(instance);
if (enter.succeeded()) {
- enter.functions()->KeyError(instance,
- key_system.Get(dispatcher()),
- session_id.Get(dispatcher()),
- media_error,
- system_error);
+ enter.functions()->SessionClosed(instance, session_id);
+ }
+}
+
+void PPB_Instance_Proxy::OnHostMsgSessionError(PP_Instance instance,
+ uint32_t session_id,
+ int32_t media_error,
+ int32_t system_error) {
+ if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
+ return;
+ EnterInstanceNoLock enter(instance);
+ if (enter.succeeded()) {
+ enter.functions()->SessionError(
+ instance, session_id, media_error, system_error);
}
}
@@ -1165,16 +1183,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/chromium/ppapi/proxy/ppb_instance_proxy.h b/chromium/ppapi/proxy/ppb_instance_proxy.h
index a6516bc1754..12e56b938e5 100644
--- a/chromium/ppapi/proxy/ppb_instance_proxy.h
+++ b/chromium/ppapi/proxy/ppb_instance_proxy.h
@@ -117,19 +117,20 @@ class PPB_Instance_Proxy : public InterfaceProxy,
virtual PP_Var GetPluginReferrerURL(
PP_Instance instance,
PP_URLComponents_Dev* components) OVERRIDE;
- virtual void KeyAdded(PP_Instance instance,
- PP_Var key_system,
- PP_Var session_id) OVERRIDE;
- virtual void KeyMessage(PP_Instance instance,
- PP_Var key_system,
- PP_Var session_id,
- PP_Var message,
- PP_Var default_url) OVERRIDE;
- virtual void KeyError(PP_Instance instance,
- PP_Var key_system,
- PP_Var session_id,
- int32_t media_error,
- int32_t system_code) OVERRIDE;
+ virtual void SessionCreated(PP_Instance instance,
+ uint32_t session_id,
+ PP_Var web_session_id) OVERRIDE;
+ virtual void SessionMessage(PP_Instance instance,
+ uint32_t session_id,
+ PP_Var message,
+ PP_Var destination_url) OVERRIDE;
+ virtual void SessionReady(PP_Instance instance, uint32_t session_id) OVERRIDE;
+ virtual void SessionClosed(PP_Instance instance,
+ uint32_t session_id) OVERRIDE;
+ virtual void SessionError(PP_Instance instance,
+ uint32_t session_id,
+ int32_t media_error,
+ int32_t system_code) OVERRIDE;
virtual void DeliverBlock(PP_Instance instance,
PP_Resource decrypted_block,
const PP_DecryptedBlockInfo* block_info) OVERRIDE;
@@ -146,9 +147,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;
@@ -219,19 +221,22 @@ class PPB_Instance_Proxy : public InterfaceProxy,
SerializedVarReturnValue result);
void OnHostMsgGetPluginReferrerURL(PP_Instance instance,
SerializedVarReturnValue result);
- virtual void OnHostMsgKeyAdded(PP_Instance instance,
- SerializedVarReceiveInput key_system,
- SerializedVarReceiveInput session_id);
- virtual void OnHostMsgKeyMessage(PP_Instance instance,
- SerializedVarReceiveInput key_system,
- SerializedVarReceiveInput session_id,
- SerializedVarReceiveInput message,
- SerializedVarReceiveInput default_url);
- virtual void OnHostMsgKeyError(PP_Instance instance,
- SerializedVarReceiveInput key_system,
- SerializedVarReceiveInput session_id,
- int32_t media_error,
- int32_t system_code);
+ virtual void OnHostMsgSessionCreated(
+ PP_Instance instance,
+ uint32_t session_id,
+ SerializedVarReceiveInput web_session_id);
+ virtual void OnHostMsgSessionMessage(
+ PP_Instance instance,
+ uint32_t session_id,
+ SerializedVarReceiveInput message,
+ SerializedVarReceiveInput destination_url);
+ virtual void OnHostMsgSessionReady(PP_Instance instance, uint32_t session_id);
+ virtual void OnHostMsgSessionClosed(PP_Instance instance,
+ uint32_t session_id);
+ virtual void OnHostMsgSessionError(PP_Instance instance,
+ uint32_t session_id,
+ int32_t media_error,
+ int32_t system_code);
virtual void OnHostMsgDecoderInitializeDone(
PP_Instance instance,
PP_DecryptorStreamType decoder_type,
@@ -253,7 +258,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/chromium/ppapi/proxy/ppb_message_loop_proxy.cc b/chromium/ppapi/proxy/ppb_message_loop_proxy.cc
index 7e2cdfa6559..582ddcbeb73 100644
--- a/chromium/ppapi/proxy/ppb_message_loop_proxy.cc
+++ b/chromium/ppapi/proxy/ppb_message_loop_proxy.cc
@@ -189,6 +189,10 @@ void MessageLoopResource::PostClosure(
}
}
+base::MessageLoopProxy* MessageLoopResource::GetMessageLoopProxy() {
+ return loop_proxy_.get();
+}
+
// static
void MessageLoopResource::ReleaseMessageLoop(void* value) {
static_cast<MessageLoopResource*>(value)->DetachFromThread();
diff --git a/chromium/ppapi/proxy/ppb_message_loop_proxy.h b/chromium/ppapi/proxy/ppb_message_loop_proxy.h
index 4e3a9332286..d8bfc4c644d 100644
--- a/chromium/ppapi/proxy/ppb_message_loop_proxy.h
+++ b/chromium/ppapi/proxy/ppb_message_loop_proxy.h
@@ -63,6 +63,8 @@ class PPAPI_PROXY_EXPORT MessageLoopResource : public MessageLoopShared {
const base::Closure& closure,
int64 delay_ms) OVERRIDE;
+ virtual base::MessageLoopProxy* GetMessageLoopProxy() OVERRIDE;
+
// TLS destructor function.
static void ReleaseMessageLoop(void* value);
diff --git a/chromium/ppapi/proxy/ppb_testing_proxy.cc b/chromium/ppapi/proxy/ppb_testing_proxy.cc
index f80e60cbf5a..0b29795f124 100644
--- a/chromium/ppapi/proxy/ppb_testing_proxy.cc
+++ b/chromium/ppapi/proxy/ppb_testing_proxy.cc
@@ -5,7 +5,7 @@
#include "ppapi/proxy/ppb_testing_proxy.h"
#include "base/message_loop/message_loop.h"
-#include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/c/private/ppb_testing_private.h"
#include "ppapi/proxy/enter_proxy.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
@@ -127,7 +127,7 @@ void SetMinimumArrayBufferSizeForShmem(PP_Instance instance,
API_ID_PPB_TESTING, threshold));
}
-const PPB_Testing_Dev testing_interface = {
+const PPB_Testing_Private testing_interface = {
&ReadImageData,
&RunMessageLoop,
&QuitMessageLoop,
@@ -139,18 +139,14 @@ const PPB_Testing_Dev testing_interface = {
&SetMinimumArrayBufferSizeForShmem
};
-InterfaceProxy* CreateTestingProxy(Dispatcher* dispatcher) {
- return new PPB_Testing_Proxy(dispatcher);
-}
-
} // namespace
PPB_Testing_Proxy::PPB_Testing_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
ppb_testing_impl_(NULL) {
if (!dispatcher->IsPlugin()) {
- ppb_testing_impl_ = static_cast<const PPB_Testing_Dev*>(
- dispatcher->local_get_interface()(PPB_TESTING_DEV_INTERFACE));
+ ppb_testing_impl_ = static_cast<const PPB_Testing_Private*>(
+ dispatcher->local_get_interface()(PPB_TESTING_PRIVATE_INTERFACE));
}
}
@@ -158,15 +154,8 @@ PPB_Testing_Proxy::~PPB_Testing_Proxy() {
}
// static
-const InterfaceProxy::Info* PPB_Testing_Proxy::GetInfo() {
- static const Info info = {
- &testing_interface,
- PPB_TESTING_DEV_INTERFACE,
- API_ID_PPB_TESTING,
- false,
- &CreateTestingProxy,
- };
- return &info;
+const PPB_Testing_Private* PPB_Testing_Proxy::GetProxyInterface() {
+ return &testing_interface;
}
bool PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) {
diff --git a/chromium/ppapi/proxy/ppb_testing_proxy.h b/chromium/ppapi/proxy/ppb_testing_proxy.h
index 61af47fcb00..bcdb53b4d70 100644
--- a/chromium/ppapi/proxy/ppb_testing_proxy.h
+++ b/chromium/ppapi/proxy/ppb_testing_proxy.h
@@ -8,7 +8,7 @@
#include "base/basictypes.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/dev/ppb_testing_dev.h"
+#include "ppapi/c/private/ppb_testing_private.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/shared_impl/host_resource.h"
@@ -25,7 +25,7 @@ class PPB_Testing_Proxy : public InterfaceProxy {
PPB_Testing_Proxy(Dispatcher* dispatcher);
virtual ~PPB_Testing_Proxy();
- static const Info* GetInfo();
+ static const PPB_Testing_Private* GetProxyInterface();
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -46,7 +46,7 @@ class PPB_Testing_Proxy : public InterfaceProxy {
// When this proxy is in the host side, this value caches the interface
// pointer so we don't have to retrieve it from the dispatcher each time.
// In the plugin, this value is always NULL.
- const PPB_Testing_Dev* ppb_testing_impl_;
+ const PPB_Testing_Private* ppb_testing_impl_;
DISALLOW_COPY_AND_ASSIGN(PPB_Testing_Proxy);
};
diff --git a/chromium/ppapi/proxy/ppb_var_deprecated_proxy.cc b/chromium/ppapi/proxy/ppb_var_deprecated_proxy.cc
index 43452ef019a..c29e15281b8 100644
--- a/chromium/ppapi/proxy/ppb_var_deprecated_proxy.cc
+++ b/chromium/ppapi/proxy/ppb_var_deprecated_proxy.cc
@@ -276,17 +276,13 @@ PP_Var CreateObject(PP_Instance instance,
return ret_var;
}
-InterfaceProxy* CreateVarDeprecatedProxy(Dispatcher* dispatcher) {
- return new PPB_Var_Deprecated_Proxy(dispatcher );
-}
-
} // namespace
PPB_Var_Deprecated_Proxy::PPB_Var_Deprecated_Proxy(
Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
- task_factory_(this),
- ppb_var_impl_(NULL) {
+ ppb_var_impl_(NULL),
+ task_factory_(this) {
if (!dispatcher->IsPlugin()) {
ppb_var_impl_ = static_cast<const PPB_Var_Deprecated*>(
dispatcher->local_get_interface()(PPB_VAR_DEPRECATED_INTERFACE));
@@ -297,7 +293,7 @@ PPB_Var_Deprecated_Proxy::~PPB_Var_Deprecated_Proxy() {
}
// static
-const InterfaceProxy::Info* PPB_Var_Deprecated_Proxy::GetInfo() {
+const PPB_Var_Deprecated* PPB_Var_Deprecated_Proxy::GetProxyInterface() {
static const PPB_Var_Deprecated var_deprecated_interface = {
ppapi::PPB_Var_Shared::GetVarInterface1_0()->AddRef,
ppapi::PPB_Var_Shared::GetVarInterface1_0()->Release,
@@ -314,15 +310,7 @@ const InterfaceProxy::Info* PPB_Var_Deprecated_Proxy::GetInfo() {
&IsInstanceOf,
&CreateObject
};
-
- static const Info info = {
- &var_deprecated_interface,
- PPB_VAR_DEPRECATED_INTERFACE,
- API_ID_PPB_VAR_DEPRECATED,
- false,
- &CreateVarDeprecatedProxy,
- };
- return &info;
+ return &var_deprecated_interface;
}
bool PPB_Var_Deprecated_Proxy::OnMessageReceived(const IPC::Message& msg) {
diff --git a/chromium/ppapi/proxy/ppb_var_deprecated_proxy.h b/chromium/ppapi/proxy/ppb_var_deprecated_proxy.h
index 59400aede6e..db62fc2af1a 100644
--- a/chromium/ppapi/proxy/ppb_var_deprecated_proxy.h
+++ b/chromium/ppapi/proxy/ppb_var_deprecated_proxy.h
@@ -28,7 +28,7 @@ class PPB_Var_Deprecated_Proxy : public InterfaceProxy {
explicit PPB_Var_Deprecated_Proxy(Dispatcher* dispatcher);
virtual ~PPB_Var_Deprecated_Proxy();
- static const Info* GetInfo();
+ static const PPB_Var_Deprecated* GetProxyInterface();
// InterfaceProxy implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
@@ -89,10 +89,11 @@ class PPB_Var_Deprecated_Proxy : public InterfaceProxy {
void SetAllowPluginReentrancy();
void DoReleaseObject(int64 object_id);
- base::WeakPtrFactory<PPB_Var_Deprecated_Proxy> task_factory_;
const PPB_Var_Deprecated* ppb_var_impl_;
+ base::WeakPtrFactory<PPB_Var_Deprecated_Proxy> task_factory_;
+
DISALLOW_COPY_AND_ASSIGN(PPB_Var_Deprecated_Proxy);
};
diff --git a/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
index d32e6320094..167e4764d38 100644
--- a/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
+++ b/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
@@ -110,8 +110,7 @@ bool InitializePppDecryptorBuffer(PP_Instance instance,
}
void Initialize(PP_Instance instance,
- PP_Var key_system,
- PP_Bool can_challenge_platform) {
+ PP_Var key_system) {
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
if (!dispatcher) {
NOTREACHED();
@@ -122,58 +121,50 @@ void Initialize(PP_Instance instance,
new PpapiMsg_PPPContentDecryptor_Initialize(
API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
instance,
- SerializedVarSendInput(dispatcher, key_system),
- PP_ToBool(can_challenge_platform)));
+ SerializedVarSendInput(dispatcher, key_system)));
}
-void GenerateKeyRequest(PP_Instance instance,
- PP_Var type,
- PP_Var init_data) {
+void CreateSession(PP_Instance instance,
+ uint32_t session_id,
+ PP_Var type,
+ PP_Var init_data) {
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
if (!dispatcher) {
NOTREACHED();
return;
}
- dispatcher->Send(
- new PpapiMsg_PPPContentDecryptor_GenerateKeyRequest(
- API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
- instance,
- SerializedVarSendInput(dispatcher, type),
- SerializedVarSendInput(dispatcher, init_data)));
+ dispatcher->Send(new PpapiMsg_PPPContentDecryptor_CreateSession(
+ API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
+ instance,
+ session_id,
+ SerializedVarSendInput(dispatcher, type),
+ SerializedVarSendInput(dispatcher, init_data)));
}
-void AddKey(PP_Instance instance,
- PP_Var session_id,
- PP_Var key,
- PP_Var init_data) {
+void UpdateSession(PP_Instance instance, uint32_t session_id, PP_Var response) {
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
if (!dispatcher) {
NOTREACHED();
return;
}
- dispatcher->Send(
- new PpapiMsg_PPPContentDecryptor_AddKey(
- API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
- instance,
- SerializedVarSendInput(dispatcher, session_id),
- SerializedVarSendInput(dispatcher, key),
- SerializedVarSendInput(dispatcher, init_data)));
+ dispatcher->Send(new PpapiMsg_PPPContentDecryptor_UpdateSession(
+ API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
+ instance,
+ session_id,
+ SerializedVarSendInput(dispatcher, response)));
}
-void CancelKeyRequest(PP_Instance instance, PP_Var session_id) {
+void ReleaseSession(PP_Instance instance, uint32_t session_id) {
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
if (!dispatcher) {
NOTREACHED();
return;
}
- dispatcher->Send(
- new PpapiMsg_PPPContentDecryptor_CancelKeyRequest(
- API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
- instance,
- SerializedVarSendInput(dispatcher, session_id)));
+ dispatcher->Send(new PpapiMsg_PPPContentDecryptor_ReleaseSession(
+ API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, session_id));
}
void Decrypt(PP_Instance instance,
@@ -365,9 +356,9 @@ void DecryptAndDecode(PP_Instance instance,
static const PPP_ContentDecryptor_Private content_decryptor_interface = {
&Initialize,
- &GenerateKeyRequest,
- &AddKey,
- &CancelKeyRequest,
+ &CreateSession,
+ &UpdateSession,
+ &ReleaseSession,
&Decrypt,
&InitializeAudioDecoder,
&InitializeVideoDecoder,
@@ -408,12 +399,12 @@ bool PPP_ContentDecryptor_Private_Proxy::OnMessageReceived(
IPC_BEGIN_MESSAGE_MAP(PPP_ContentDecryptor_Private_Proxy, msg)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Initialize,
OnMsgInitialize)
- IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_GenerateKeyRequest,
- OnMsgGenerateKeyRequest)
- IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_AddKey,
- OnMsgAddKey)
- IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_CancelKeyRequest,
- OnMsgCancelKeyRequest)
+ IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_CreateSession,
+ OnMsgCreateSession)
+ IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_UpdateSession,
+ OnMsgUpdateSession)
+ IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_ReleaseSession,
+ OnMsgReleaseSession)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_Decrypt,
OnMsgDecrypt)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPContentDecryptor_InitializeAudioDecoder,
@@ -434,50 +425,48 @@ bool PPP_ContentDecryptor_Private_Proxy::OnMessageReceived(
void PPP_ContentDecryptor_Private_Proxy::OnMsgInitialize(
PP_Instance instance,
- SerializedVarReceiveInput key_system,
- bool can_challenge_platform) {
+ SerializedVarReceiveInput key_system) {
if (ppp_decryptor_impl_) {
CallWhileUnlocked(
ppp_decryptor_impl_->Initialize,
instance,
- ExtractReceivedVarAndAddRef(dispatcher(), &key_system),
- PP_FromBool(can_challenge_platform));
+ ExtractReceivedVarAndAddRef(dispatcher(), &key_system));
}
}
-void PPP_ContentDecryptor_Private_Proxy::OnMsgGenerateKeyRequest(
+void PPP_ContentDecryptor_Private_Proxy::OnMsgCreateSession(
PP_Instance instance,
+ uint32_t session_id,
SerializedVarReceiveInput type,
SerializedVarReceiveInput init_data) {
if (ppp_decryptor_impl_) {
- CallWhileUnlocked(ppp_decryptor_impl_->GenerateKeyRequest,
+ CallWhileUnlocked(ppp_decryptor_impl_->CreateSession,
instance,
+ session_id,
ExtractReceivedVarAndAddRef(dispatcher(), &type),
ExtractReceivedVarAndAddRef(dispatcher(), &init_data));
}
}
-void PPP_ContentDecryptor_Private_Proxy::OnMsgAddKey(
+void PPP_ContentDecryptor_Private_Proxy::OnMsgUpdateSession(
PP_Instance instance,
- SerializedVarReceiveInput session_id,
- SerializedVarReceiveInput key,
- SerializedVarReceiveInput init_data) {
+ uint32_t session_id,
+ SerializedVarReceiveInput response) {
if (ppp_decryptor_impl_) {
- CallWhileUnlocked(ppp_decryptor_impl_->AddKey,
+ CallWhileUnlocked(ppp_decryptor_impl_->UpdateSession,
instance,
- ExtractReceivedVarAndAddRef(dispatcher(), &session_id),
- ExtractReceivedVarAndAddRef(dispatcher(), &key),
- ExtractReceivedVarAndAddRef(dispatcher(), &init_data));
+ session_id,
+ ExtractReceivedVarAndAddRef(dispatcher(), &response));
}
}
-void PPP_ContentDecryptor_Private_Proxy::OnMsgCancelKeyRequest(
+void PPP_ContentDecryptor_Private_Proxy::OnMsgReleaseSession(
PP_Instance instance,
- SerializedVarReceiveInput session_id) {
+ uint32_t session_id) {
if (ppp_decryptor_impl_) {
- CallWhileUnlocked(ppp_decryptor_impl_->CancelKeyRequest,
+ CallWhileUnlocked(ppp_decryptor_impl_->ReleaseSession,
instance,
- ExtractReceivedVarAndAddRef(dispatcher(), &session_id));
+ session_id);
}
}
diff --git a/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.h b/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.h
index 2e4ad8548a9..dfbcf4f5d42 100644
--- a/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.h
+++ b/chromium/ppapi/proxy/ppp_content_decryptor_private_proxy.h
@@ -31,17 +31,15 @@ class PPP_ContentDecryptor_Private_Proxy : public InterfaceProxy {
// Message handlers.
void OnMsgInitialize(PP_Instance instance,
- SerializedVarReceiveInput key_system,
- bool can_challenge_platform);
- void OnMsgGenerateKeyRequest(PP_Instance instance,
- SerializedVarReceiveInput type,
- SerializedVarReceiveInput init_data);
- void OnMsgAddKey(PP_Instance instance,
- SerializedVarReceiveInput session_id,
- SerializedVarReceiveInput key,
- SerializedVarReceiveInput init_data);
- void OnMsgCancelKeyRequest(PP_Instance instance,
- SerializedVarReceiveInput session_id);
+ SerializedVarReceiveInput key_system);
+ void OnMsgCreateSession(PP_Instance instance,
+ uint32_t session_id,
+ SerializedVarReceiveInput type,
+ SerializedVarReceiveInput init_data);
+ void OnMsgUpdateSession(PP_Instance instance,
+ uint32_t session_id,
+ SerializedVarReceiveInput response);
+ void OnMsgReleaseSession(PP_Instance instance, uint32_t session_id);
void OnMsgDecrypt(PP_Instance instance,
const PPPDecryptor_Buffer& encrypted_buffer,
const std::string& serialized_encrypted_block_info);
diff --git a/chromium/ppapi/proxy/printing_resource_unittest.cc b/chromium/ppapi/proxy/printing_resource_unittest.cc
index af6c7420f27..6551ba17664 100644
--- a/chromium/ppapi/proxy/printing_resource_unittest.cc
+++ b/chromium/ppapi/proxy/printing_resource_unittest.cc
@@ -8,6 +8,7 @@
#include "ppapi/c/dev/ppb_printing_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/proxy/locking_resource_releaser.h"
+#include "ppapi/proxy/plugin_message_filter.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
#include "ppapi/proxy/printing_resource.h"
@@ -76,10 +77,10 @@ TEST_F(PrintingResourceTest, GetDefaultPrintSettings) {
PP_FALSE,
PP_PRINTOUTPUTFORMAT_PDF
};
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(reply_params,
- PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply(
- reply_settings))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params,
+ PpapiPluginMsg_Printing_GetDefaultPrintSettingsReply(
+ reply_settings));
EXPECT_TRUE(PP_RectEqual(reply_settings.printable_area,
output_settings.printable_area));
diff --git a/chromium/ppapi/proxy/raw_var_data.cc b/chromium/ppapi/proxy/raw_var_data.cc
index b41304849ba..49ee8c261dd 100644
--- a/chromium/ppapi/proxy/raw_var_data.cc
+++ b/chromium/ppapi/proxy/raw_var_data.cc
@@ -13,6 +13,7 @@
#include "ppapi/shared_impl/array_var.h"
#include "ppapi/shared_impl/dictionary_var.h"
#include "ppapi/shared_impl/ppapi_globals.h"
+#include "ppapi/shared_impl/resource_var.h"
#include "ppapi/shared_impl/scoped_pp_var.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/shared_impl/var_tracker.h"
@@ -241,10 +242,7 @@ RawVarData* RawVarData::Create(PP_VarType type) {
case PP_VARTYPE_DICTIONARY:
return new DictionaryRawVarData();
case PP_VARTYPE_RESOURCE:
- // TODO(mgiuca): Add ResourceRawVarData. (http://crbug.com/177017)
- // This path will be reached if a NaCl module attempts to pass a
- // PP_VARTYPE_RESOURCE in a message.
- break;
+ return new ResourceRawVarData();
}
NOTREACHED();
return NULL;
@@ -666,5 +664,88 @@ bool DictionaryRawVarData::Read(PP_VarType type,
return true;
}
+// ResourceRawVarData ----------------------------------------------------------
+ResourceRawVarData::ResourceRawVarData()
+ : pp_resource_(0),
+ pending_renderer_host_id_(0),
+ pending_browser_host_id_(0) {}
+
+ResourceRawVarData::~ResourceRawVarData() {
+}
+
+PP_VarType ResourceRawVarData::Type() {
+ return PP_VARTYPE_RESOURCE;
+}
+
+bool ResourceRawVarData::Init(const PP_Var& var, PP_Instance /*instance*/) {
+ DCHECK(var.type == PP_VARTYPE_RESOURCE);
+ ResourceVar* resource_var = ResourceVar::FromPPVar(var);
+ if (!resource_var)
+ return false;
+ pp_resource_ = resource_var->GetPPResource();
+ const IPC::Message* message = resource_var->GetCreationMessage();
+ if (message)
+ creation_message_.reset(new IPC::Message(*message));
+ else
+ creation_message_.reset();
+ pending_renderer_host_id_ = resource_var->GetPendingRendererHostId();
+ pending_browser_host_id_ = resource_var->GetPendingBrowserHostId();
+ initialized_ = true;
+ return true;
+}
+
+PP_Var ResourceRawVarData::CreatePPVar(PP_Instance instance) {
+ // If this is not a pending resource host, just create the var.
+ if (pp_resource_ || !creation_message_) {
+ return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar(
+ pp_resource_);
+ }
+
+ // This is a pending resource host, so create the resource and var.
+ return PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVarFromMessage(
+ instance,
+ *creation_message_,
+ pending_renderer_host_id_,
+ pending_browser_host_id_);
+}
+
+void ResourceRawVarData::PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) {
+}
+
+void ResourceRawVarData::Write(IPC::Message* m,
+ const HandleWriter& handle_writer) {
+ m->WriteInt(static_cast<int>(pp_resource_));
+ m->WriteInt(pending_renderer_host_id_);
+ m->WriteInt(pending_browser_host_id_);
+ m->WriteBool(creation_message_);
+ if (creation_message_)
+ IPC::ParamTraits<IPC::Message>::Write(m, *creation_message_);
+}
+
+bool ResourceRawVarData::Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) {
+ int value;
+ if (!m->ReadInt(iter, &value))
+ return false;
+ pp_resource_ = static_cast<PP_Resource>(value);
+ if (!m->ReadInt(iter, &pending_renderer_host_id_))
+ return false;
+ if (!m->ReadInt(iter, &pending_browser_host_id_))
+ return false;
+ bool has_creation_message;
+ if (!m->ReadBool(iter, &has_creation_message))
+ return false;
+ if (has_creation_message) {
+ creation_message_.reset(new IPC::Message());
+ if (!IPC::ParamTraits<IPC::Message>::Read(m, iter, creation_message_.get()))
+ return false;
+ } else {
+ creation_message_.reset();
+ }
+ return true;
+}
+
} // namespace proxy
} // namespace ppapi
diff --git a/chromium/ppapi/proxy/raw_var_data.h b/chromium/ppapi/proxy/raw_var_data.h
index c7981d38ff7..d45ea53f24c 100644
--- a/chromium/ppapi/proxy/raw_var_data.h
+++ b/chromium/ppapi/proxy/raw_var_data.h
@@ -255,6 +255,47 @@ class DictionaryRawVarData : public RawVarData {
std::vector<std::pair<std::string, size_t> > children_;
};
+// A RawVarData class for resource PP_Vars.
+// This class does not hold a reference on the PP_Resource that is being
+// serialized. If sending a resource from the plugin to the host, the plugin
+// should not release the ResourceVar before sending the serialized message to
+// the host, and the host should immediately consume the ResourceVar before
+// processing further messages.
+class ResourceRawVarData : public RawVarData {
+ public:
+ ResourceRawVarData();
+ virtual ~ResourceRawVarData();
+
+ // RawVarData implementation.
+ virtual PP_VarType Type() OVERRIDE;
+ virtual bool Init(const PP_Var& var, PP_Instance instance) OVERRIDE;
+ virtual PP_Var CreatePPVar(PP_Instance instance) OVERRIDE;
+ virtual void PopulatePPVar(const PP_Var& var,
+ const std::vector<PP_Var>& graph) OVERRIDE;
+ virtual void Write(IPC::Message* m,
+ const HandleWriter& handle_writer) OVERRIDE;
+ virtual bool Read(PP_VarType type,
+ const IPC::Message* m,
+ PickleIterator* iter) OVERRIDE;
+
+ private:
+ // Resource ID in the plugin. If one has not yet been created, this is 0.
+ // This is a borrowed reference; the resource's refcount is not incremented.
+ PP_Resource pp_resource_;
+
+ // Pending resource host ID in the renderer.
+ int pending_renderer_host_id_;
+
+ // Pending resource host ID in the browser.
+ int pending_browser_host_id_;
+
+ // A message containing information about how to create a plugin-side
+ // resource. The message type will vary based on the resource type, and will
+ // usually contain a pending resource host ID, and other required information.
+ // If the resource was created directly, this is NULL.
+ scoped_ptr<IPC::Message> creation_message_;
+};
+
} // namespace proxy
} // namespace ppapi
diff --git a/chromium/ppapi/proxy/raw_var_data_unittest.cc b/chromium/ppapi/proxy/raw_var_data_unittest.cc
index c45ca9d6967..03408923322 100644
--- a/chromium/ppapi/proxy/raw_var_data_unittest.cc
+++ b/chromium/ppapi/proxy/raw_var_data_unittest.cc
@@ -14,6 +14,7 @@
#include "ppapi/shared_impl/dictionary_var.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/resource_var.h"
#include "ppapi/shared_impl/scoped_pp_var.h"
#include "ppapi/shared_impl/test_globals.h"
#include "ppapi/shared_impl/unittest_utils.h"
@@ -186,5 +187,17 @@ TEST_F(RawVarDataTest, DictionaryArrayTest) {
array->Set(index, PP_MakeUndefined());
}
+TEST_F(RawVarDataTest, ResourceTest) {
+ // TODO(mgiuca): This test passes trivially, since GetVarTracker() returns a
+ // TestVarTracker which returns a null PP_Var.
+ ScopedPPVar resource(
+ ScopedPPVar::PassRef(),
+ PpapiGlobals::Get()->GetVarTracker()->MakeResourcePPVar(34));
+ EXPECT_TRUE(WriteReadAndCompare(resource.get()));
+
+ // TODO(mgiuca): Test a host resource with an IPC::Message. It is currently a
+ // checkfail to deserialize such a resource.
+}
+
} // namespace proxy
} // namespace ppapi
diff --git a/chromium/ppapi/proxy/resource_creation_proxy.cc b/chromium/ppapi/proxy/resource_creation_proxy.cc
index d1b99ecb014..231142a937d 100644
--- a/chromium/ppapi/proxy/resource_creation_proxy.cc
+++ b/chromium/ppapi/proxy/resource_creation_proxy.cc
@@ -8,7 +8,6 @@
#include "ppapi/c/pp_size.h"
#include "ppapi/proxy/audio_input_resource.h"
#include "ppapi/proxy/connection.h"
-#include "ppapi/proxy/ext_crx_file_system_private_resource.h"
#include "ppapi/proxy/file_chooser_resource.h"
#include "ppapi/proxy/file_io_resource.h"
#include "ppapi/proxy/file_ref_resource.h"
@@ -21,6 +20,7 @@
#include "ppapi/proxy/host_resolver_resource.h"
#include "ppapi/proxy/net_address_resource.h"
#include "ppapi/proxy/network_monitor_resource.h"
+#include "ppapi/proxy/output_protection_resource.h"
#include "ppapi/proxy/platform_verification_private_resource.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_globals.h"
@@ -313,6 +313,12 @@ PP_Resource ResourceCreationProxy::CreateNetworkMonitor(
GetReference();
}
+PP_Resource ResourceCreationProxy::CreateOutputProtectionPrivate(
+ PP_Instance instance) {
+ return (new OutputProtectionResource(GetConnection(), instance))->
+ GetReference();
+}
+
PP_Resource ResourceCreationProxy::CreatePrinting(PP_Instance instance) {
return (new PrintingResource(GetConnection(), instance))->GetReference();
}
diff --git a/chromium/ppapi/proxy/resource_creation_proxy.h b/chromium/ppapi/proxy/resource_creation_proxy.h
index 1507dc8c6c5..df564da7ca3 100644
--- a/chromium/ppapi/proxy/resource_creation_proxy.h
+++ b/chromium/ppapi/proxy/resource_creation_proxy.h
@@ -134,6 +134,8 @@ class ResourceCreationProxy : public InterfaceProxy,
PP_Instance instance,
const PP_NetAddress_Private& private_addr) OVERRIDE;
virtual PP_Resource CreateNetworkMonitor(PP_Instance instance) OVERRIDE;
+ virtual PP_Resource CreateOutputProtectionPrivate(
+ PP_Instance instance) OVERRIDE;
virtual PP_Resource CreatePrinting(PP_Instance) OVERRIDE;
virtual PP_Resource CreateTCPServerSocketPrivate(
PP_Instance instance) OVERRIDE;
diff --git a/chromium/ppapi/proxy/resource_reply_thread_registrar.cc b/chromium/ppapi/proxy/resource_reply_thread_registrar.cc
new file mode 100644
index 00000000000..0c49cf5c7b5
--- /dev/null
+++ b/chromium/ppapi/proxy/resource_reply_thread_registrar.cc
@@ -0,0 +1,71 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/proxy/resource_reply_thread_registrar.h"
+
+#include "base/logging.h"
+#include "base/message_loop/message_loop_proxy.h"
+#include "ppapi/shared_impl/proxy_lock.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+
+namespace ppapi {
+namespace proxy {
+
+ResourceReplyThreadRegistrar::ResourceReplyThreadRegistrar(
+ scoped_refptr<base::MessageLoopProxy> default_thread)
+ : default_thread_(default_thread) {
+}
+
+ResourceReplyThreadRegistrar::~ResourceReplyThreadRegistrar() {
+}
+
+void ResourceReplyThreadRegistrar::Register(
+ PP_Resource resource,
+ int32_t sequence_number,
+ scoped_refptr<TrackedCallback> reply_thread_hint) {
+ ProxyLock::AssertAcquiredDebugOnly();
+
+ // Use the default thread if |reply_thread_hint| is NULL or blocking.
+ if (!reply_thread_hint || reply_thread_hint->is_blocking())
+ return;
+
+ DCHECK(reply_thread_hint->target_loop());
+ scoped_refptr<base::MessageLoopProxy> reply_thread(
+ reply_thread_hint->target_loop()->GetMessageLoopProxy());
+ {
+ base::AutoLock auto_lock(lock_);
+
+ if (reply_thread == default_thread_)
+ return;
+
+ map_[resource][sequence_number] = reply_thread;
+ }
+}
+
+void ResourceReplyThreadRegistrar::Unregister(PP_Resource resource) {
+ base::AutoLock auto_lock(lock_);
+ map_.erase(resource);
+}
+
+scoped_refptr<base::MessageLoopProxy>
+ResourceReplyThreadRegistrar::GetTargetThreadAndUnregister(
+ PP_Resource resource,
+ int32_t sequence_number) {
+ base::AutoLock auto_lock(lock_);
+ ResourceMap::iterator resource_iter = map_.find(resource);
+ if (resource_iter == map_.end())
+ return default_thread_;
+
+ SequenceNumberMap::iterator sequence_number_iter =
+ resource_iter->second.find(sequence_number);
+ if (sequence_number_iter == resource_iter->second.end())
+ return default_thread_;
+
+ scoped_refptr<base::MessageLoopProxy> target = sequence_number_iter->second;
+ resource_iter->second.erase(sequence_number_iter);
+ return target;
+}
+
+} // namespace proxy
+} // namespace ppapi
diff --git a/chromium/ppapi/proxy/resource_reply_thread_registrar.h b/chromium/ppapi/proxy/resource_reply_thread_registrar.h
new file mode 100644
index 00000000000..eef6d615965
--- /dev/null
+++ b/chromium/ppapi/proxy/resource_reply_thread_registrar.h
@@ -0,0 +1,70 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_
+#define PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_
+
+#include <map>
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/synchronization/lock.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+
+
+namespace base {
+class MessageLoopProxy;
+}
+
+namespace ppapi {
+
+class TrackedCallback;
+
+namespace proxy {
+
+// ResourceReplyThreadRegistrar records the handling thread for
+// PpapiPluginMsg_ResourceReply messages.
+// This class is thread safe.
+class PPAPI_PROXY_EXPORT ResourceReplyThreadRegistrar
+ : public base::RefCountedThreadSafe<ResourceReplyThreadRegistrar> {
+ public:
+ explicit ResourceReplyThreadRegistrar(
+ scoped_refptr<base::MessageLoopProxy> default_thread);
+
+ // This method can only be called while holding the Pepper proxy lock; the
+ // other methods can be called with/without the Pepper proxy lock.
+ void Register(PP_Resource resource,
+ int32_t sequence_number,
+ scoped_refptr<TrackedCallback> reply_thread_hint);
+
+ void Unregister(PP_Resource resource);
+
+ scoped_refptr<base::MessageLoopProxy> GetTargetThreadAndUnregister(
+ PP_Resource resource,
+ int32_t sequence_number);
+
+ private:
+ friend class base::RefCountedThreadSafe<ResourceReplyThreadRegistrar>;
+
+ typedef std::map<int32_t, scoped_refptr<base::MessageLoopProxy> >
+ SequenceNumberMap;
+ typedef std::map<PP_Resource, SequenceNumberMap> ResourceMap;
+
+ ~ResourceReplyThreadRegistrar();
+
+ // The lock that protects the data members below.
+ // Please note that we should never try to acquire the Pepper proxy lock while
+ // holding |lock_|, otherwise we will cause deadlock.
+ base::Lock lock_;
+ ResourceMap map_;
+ scoped_refptr<base::MessageLoopProxy> default_thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(ResourceReplyThreadRegistrar);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_
diff --git a/chromium/ppapi/proxy/talk_resource_unittest.cc b/chromium/ppapi/proxy/talk_resource_unittest.cc
index e81a8a6aca3..3b7d5ff43fe 100644
--- a/chromium/ppapi/proxy/talk_resource_unittest.cc
+++ b/chromium/ppapi/proxy/talk_resource_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "ppapi/proxy/locking_resource_releaser.h"
+#include "ppapi/proxy/plugin_message_filter.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
#include "ppapi/proxy/talk_resource.h"
@@ -58,8 +59,7 @@ class TalkResourceTest : public PluginProxyTest {
ResourceMessageReplyParams reply_params(params.pp_resource(),
params.sequence());
reply_params.set_result(result);
- IPC::Message reply_msg = PpapiPluginMsg_ResourceReply(reply_params, reply);
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(reply_msg));
+ PluginMessageFilter::DispatchResourceReplyForTest(reply_params, reply);
}
};
@@ -84,9 +84,8 @@ TEST_F(TalkResourceTest, GetPermission) {
ResourceMessageReplyParams reply_params(params.pp_resource(),
params.sequence());
reply_params.set_result(1);
- IPC::Message reply = PpapiPluginMsg_ResourceReply(
+ PluginMessageFilter::DispatchResourceReplyForTest(
reply_params, PpapiPluginMsg_Talk_RequestPermissionReply());
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(reply));
ASSERT_TRUE(callback.called());
ASSERT_EQ(1, callback.result());
@@ -111,9 +110,8 @@ TEST_F(TalkResourceTest, RequestPermission) {
ResourceMessageReplyParams reply_params(params.pp_resource(),
params.sequence());
reply_params.set_result(1);
- IPC::Message reply = PpapiPluginMsg_ResourceReply(
+ PluginMessageFilter::DispatchResourceReplyForTest(
reply_params, PpapiPluginMsg_Talk_RequestPermissionReply());
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(reply));
ASSERT_TRUE(callback.called());
ASSERT_EQ(1, callback.result());
@@ -143,9 +141,8 @@ TEST_F(TalkResourceTest, StartStopRemoting) {
// Receive an event
ASSERT_FALSE(event_callback.called());
ResourceMessageReplyParams notify_params(res.get(), 0);
- IPC::Message notify = PpapiPluginMsg_ResourceReply(
+ PluginMessageFilter::DispatchResourceReplyForTest(
notify_params, PpapiPluginMsg_Talk_NotifyEvent(PP_TALKEVENT_ERROR));
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(notify));
ASSERT_TRUE(event_callback.called());
ASSERT_EQ(PP_TALKEVENT_ERROR, event_callback.result());
@@ -165,7 +162,8 @@ TEST_F(TalkResourceTest, StartStopRemoting) {
// Events should be discarded at this point
event_callback.Reset();
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(notify));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ notify_params, PpapiPluginMsg_Talk_NotifyEvent(PP_TALKEVENT_ERROR));
ASSERT_FALSE(event_callback.called());
}
diff --git a/chromium/ppapi/proxy/tcp_socket_resource_base.cc b/chromium/ppapi/proxy/tcp_socket_resource_base.cc
index 6cb9d0b7b51..fff2da3cf8a 100644
--- a/chromium/ppapi/proxy/tcp_socket_resource_base.cc
+++ b/chromium/ppapi/proxy/tcp_socket_resource_base.cc
@@ -84,7 +84,8 @@ int32_t TCPSocketResourceBase::BindImpl(
BROWSER,
PpapiHostMsg_TCPSocket_Bind(*addr),
base::Bind(&TCPSocketResourceBase::OnPluginMsgBindReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -106,7 +107,8 @@ int32_t TCPSocketResourceBase::ConnectImpl(
BROWSER,
PpapiHostMsg_TCPSocket_Connect(host, port),
base::Bind(&TCPSocketResourceBase::OnPluginMsgConnectReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -127,7 +129,8 @@ int32_t TCPSocketResourceBase::ConnectWithNetAddressImpl(
BROWSER,
PpapiHostMsg_TCPSocket_ConnectWithNetAddress(*addr),
base::Bind(&TCPSocketResourceBase::OnPluginMsgConnectReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -172,7 +175,8 @@ int32_t TCPSocketResourceBase::SSLHandshakeImpl(
trusted_certificates_,
untrusted_certificates_),
base::Bind(&TCPSocketResourceBase::OnPluginMsgSSLHandshakeReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -233,7 +237,8 @@ int32_t TCPSocketResourceBase::ReadImpl(
BROWSER,
PpapiHostMsg_TCPSocket_Read(bytes_to_read_),
base::Bind(&TCPSocketResourceBase::OnPluginMsgReadReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -259,7 +264,8 @@ int32_t TCPSocketResourceBase::WriteImpl(
BROWSER,
PpapiHostMsg_TCPSocket_Write(std::string(buffer, bytes_to_write)),
base::Bind(&TCPSocketResourceBase::OnPluginMsgWriteReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -280,7 +286,8 @@ int32_t TCPSocketResourceBase::ListenImpl(
BROWSER,
PpapiHostMsg_TCPSocket_Listen(backlog),
base::Bind(&TCPSocketResourceBase::OnPluginMsgListenReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -301,7 +308,8 @@ int32_t TCPSocketResourceBase::AcceptImpl(
BROWSER,
PpapiHostMsg_TCPSocket_Accept(),
base::Bind(&TCPSocketResourceBase::OnPluginMsgAcceptReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -363,7 +371,8 @@ int32_t TCPSocketResourceBase::SetOptionImpl(
BROWSER,
PpapiHostMsg_TCPSocket_SetOption(name, option_data),
base::Bind(&TCPSocketResourceBase::OnPluginMsgSetOptionReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
diff --git a/chromium/ppapi/proxy/udp_socket_resource_base.cc b/chromium/ppapi/proxy/udp_socket_resource_base.cc
index 8ef3835feca..79ac3484d25 100644
--- a/chromium/ppapi/proxy/udp_socket_resource_base.cc
+++ b/chromium/ppapi/proxy/udp_socket_resource_base.cc
@@ -91,7 +91,8 @@ int32_t UDPSocketResourceBase::SetOptionImpl(
PpapiHostMsg_UDPSocket_SetOption(name, option_data),
base::Bind(&UDPSocketResourceBase::OnPluginMsgSetOptionReply,
base::Unretained(this),
- callback));
+ callback),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -112,7 +113,8 @@ int32_t UDPSocketResourceBase::BindImpl(
BROWSER,
PpapiHostMsg_UDPSocket_Bind(*addr),
base::Bind(&UDPSocketResourceBase::OnPluginMsgBindReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -146,7 +148,8 @@ int32_t UDPSocketResourceBase::RecvFromImpl(
BROWSER,
PpapiHostMsg_UDPSocket_RecvFrom(bytes_to_read_),
base::Bind(&UDPSocketResourceBase::OnPluginMsgRecvFromReply,
- base::Unretained(this), addr));
+ base::Unretained(this), addr),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
@@ -180,7 +183,8 @@ int32_t UDPSocketResourceBase::SendToImpl(
BROWSER,
PpapiHostMsg_UDPSocket_SendTo(std::string(buffer, num_bytes), *addr),
base::Bind(&UDPSocketResourceBase::OnPluginMsgSendToReply,
- base::Unretained(this)));
+ base::Unretained(this)),
+ callback);
return PP_OK_COMPLETIONPENDING;
}
diff --git a/chromium/ppapi/proxy/websocket_resource.cc b/chromium/ppapi/proxy/websocket_resource.cc
index 394a2c54f9e..c998cd94b72 100644
--- a/chromium/ppapi/proxy/websocket_resource.cc
+++ b/chromium/ppapi/proxy/websocket_resource.cc
@@ -137,13 +137,13 @@ int32_t WebSocketResource::Close(uint16_t code,
// Validate |code| and |reason|.
scoped_refptr<StringVar> reason_string_var;
std::string reason_string;
- WebKit::WebSocket::CloseEventCode event_code =
- static_cast<WebKit::WebSocket::CloseEventCode>(code);
+ blink::WebSocket::CloseEventCode event_code =
+ static_cast<blink::WebSocket::CloseEventCode>(code);
if (code == PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED) {
// PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED and CloseEventCodeNotSpecified are
// assigned to different values. A conversion is needed if
// PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED is specified.
- event_code = WebKit::WebSocket::CloseEventCodeNotSpecified;
+ event_code = blink::WebSocket::CloseEventCodeNotSpecified;
} else {
if (!(code == PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE ||
(PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN <= code &&
diff --git a/chromium/ppapi/proxy/websocket_resource_unittest.cc b/chromium/ppapi/proxy/websocket_resource_unittest.cc
index ecd9111c980..5cfc71a88e3 100644
--- a/chromium/ppapi/proxy/websocket_resource_unittest.cc
+++ b/chromium/ppapi/proxy/websocket_resource_unittest.cc
@@ -8,6 +8,7 @@
#include "ppapi/c/ppb_var.h"
#include "ppapi/c/ppb_websocket.h"
#include "ppapi/proxy/locking_resource_releaser.h"
+#include "ppapi/proxy/plugin_message_filter.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
#include "ppapi/proxy/websocket_resource.h"
@@ -84,9 +85,8 @@ TEST_F(WebSocketResourceTest, Connect) {
ResourceMessageReplyParams reply_params(params.pp_resource(),
params.sequence());
reply_params.set_result(PP_OK);
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(reply_params,
- PpapiPluginMsg_WebSocket_ConnectReply(url, protocol1))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params, PpapiPluginMsg_WebSocket_ConnectReply(url, protocol1));
EXPECT_EQ(PP_OK, g_callback_result);
EXPECT_EQ(true, g_callback_called);
@@ -102,20 +102,17 @@ TEST_F(WebSocketResourceTest, UnsolicitedReplies) {
// Check if BufferedAmountReply is handled.
ResourceMessageReplyParams reply_params(res.get(), 0);
reply_params.set_result(PP_OK);
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_WebSocket_BufferedAmountReply(19760227u))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params, PpapiPluginMsg_WebSocket_BufferedAmountReply(19760227u));
uint64_t amount = websocket_iface->GetBufferedAmount(res.get());
EXPECT_EQ(19760227u, amount);
// Check if StateReply is handled.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_WebSocket_StateReply(
- static_cast<int32_t>(PP_WEBSOCKETREADYSTATE_CLOSING)))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params,
+ PpapiPluginMsg_WebSocket_StateReply(
+ static_cast<int32_t>(PP_WEBSOCKETREADYSTATE_CLOSING)));
PP_WebSocketReadyState state = websocket_iface->GetReadyState(res.get());
EXPECT_EQ(PP_WEBSOCKETREADYSTATE_CLOSING, state);
@@ -143,9 +140,9 @@ TEST_F(WebSocketResourceTest, MessageError) {
ResourceMessageReplyParams connect_reply_params(params.pp_resource(),
params.sequence());
connect_reply_params.set_result(PP_OK);
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(connect_reply_params,
- PpapiPluginMsg_WebSocket_ConnectReply(url, std::string()))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ connect_reply_params,
+ PpapiPluginMsg_WebSocket_ConnectReply(url, std::string()));
EXPECT_EQ(PP_OK, g_callback_result);
EXPECT_TRUE(g_callback_called);
@@ -157,9 +154,8 @@ TEST_F(WebSocketResourceTest, MessageError) {
// Synthesize a WebSocket_ErrorReply message.
ResourceMessageReplyParams error_reply_params(res.get(), 0);
error_reply_params.set_result(PP_OK);
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(error_reply_params,
- PpapiPluginMsg_WebSocket_ErrorReply())));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ error_reply_params, PpapiPluginMsg_WebSocket_ErrorReply());
EXPECT_EQ(PP_ERROR_FAILED, g_callback_result);
EXPECT_TRUE(g_callback_called);