summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/serialized_var.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 00:26:43 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 00:26:43 +0000
commit4614f1974881ecfd0a0118683bac628c6128c2a9 (patch)
treec69836459560dd8003f7e18ca554f2e1d7f79b4d /ppapi/proxy/serialized_var.cc
parentb8e6654fb91108033580f510e2d411093936fc2f (diff)
downloadchromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.zip
chromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.tar.gz
chromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.tar.bz2
First pass at making the proxy handle multiple renderers. This associates the
instance with resources and has most callers retrieve the dispatcher according to the appropriate instance. This isn't hooked up to anything yet. This changes some PPB_Flash interface methods to use PP_Bool. The most challenging part of the change is in the plugin_var_tracker which now needs to track which dispatcher each var object came from, and remap var IDs since each renderer will be generating var IDs in its own space, which will likely overlap. A similar system will need to be done for resources which is not implemented yet. I added some null checks in audio_impl because audio_ can be NULL in some cases when using the trusted API. I discovered this when testing NaCl for this patch. Review URL: http://codereview.chromium.org/6282007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/serialized_var.cc')
-rw-r--r--ppapi/proxy/serialized_var.cc38
1 files changed, 21 insertions, 17 deletions
diff --git a/ppapi/proxy/serialized_var.cc b/ppapi/proxy/serialized_var.cc
index a5356c5..5987ceb 100644
--- a/ppapi/proxy/serialized_var.cc
+++ b/ppapi/proxy/serialized_var.cc
@@ -225,9 +225,9 @@ SerializedVar::~SerializedVar() {
SerializedVarSendInput::SerializedVarSendInput(Dispatcher* dispatcher,
const PP_Var& var)
- : SerializedVar(dispatcher->serialization_rules(), var) {
- dispatcher->serialization_rules()->SendCallerOwned(var,
- inner_->GetStringPtr());
+ : SerializedVar(dispatcher->serialization_rules()) {
+ inner_->SetVar(dispatcher->serialization_rules()->SendCallerOwned(
+ var, inner_->GetStringPtr()));
}
// static
@@ -237,9 +237,10 @@ void SerializedVarSendInput::ConvertVector(Dispatcher* dispatcher,
std::vector<SerializedVar>* output) {
output->resize(input_count);
for (size_t i = 0; i < input_count; i++) {
- (*output)[i] = SerializedVar(dispatcher->serialization_rules(), input[i]);
- dispatcher->serialization_rules()->SendCallerOwned(
- input[i], (*output)[i].inner_->GetStringPtr());
+ SerializedVar& cur = (*output)[i];
+ cur = SerializedVar(dispatcher->serialization_rules());
+ cur.inner_->SetVar(dispatcher->serialization_rules()->SendCallerOwned(
+ input[i], cur.inner_->GetStringPtr()));
}
}
@@ -251,7 +252,7 @@ ReceiveSerializedVarReturnValue::ReceiveSerializedVarReturnValue() {
PP_Var ReceiveSerializedVarReturnValue::Return(Dispatcher* dispatcher) {
inner_->set_serialization_rules(dispatcher->serialization_rules());
inner_->SetVar(inner_->serialization_rules()->ReceivePassRef(
- inner_->GetIncompleteVar(), inner_->GetString()));
+ inner_->GetIncompleteVar(), inner_->GetString(), dispatcher));
return inner_->GetVar();
}
@@ -260,6 +261,7 @@ PP_Var ReceiveSerializedVarReturnValue::Return(Dispatcher* dispatcher) {
ReceiveSerializedException::ReceiveSerializedException(Dispatcher* dispatcher,
PP_Var* exception)
: SerializedVar(dispatcher->serialization_rules()),
+ dispatcher_(dispatcher),
exception_(exception) {
}
@@ -268,7 +270,7 @@ ReceiveSerializedException::~ReceiveSerializedException() {
// When an output exception is specified, it will take ownership of the
// reference.
inner_->SetVar(inner_->serialization_rules()->ReceivePassRef(
- inner_->GetIncompleteVar(), inner_->GetString()));
+ inner_->GetIncompleteVar(), inner_->GetString(), dispatcher_));
*exception_ = inner_->GetVar();
} else {
// When no output exception is specified, the browser thinks we have a ref
@@ -342,7 +344,8 @@ PP_Var SerializedVarReceiveInput::Get(Dispatcher* dispatcher) {
serialized_.inner_->SetVar(
serialized_.inner_->serialization_rules()->BeginReceiveCallerOwned(
serialized_.inner_->GetIncompleteVar(),
- serialized_.inner_->GetStringPtr()));
+ serialized_.inner_->GetStringPtr(),
+ dispatcher));
return serialized_.inner_->GetVar();
}
@@ -372,7 +375,8 @@ PP_Var* SerializedVarVectorReceiveInput::Get(Dispatcher* dispatcher,
serialized_[i].inner_->SetVar(
serialized_[i].inner_->serialization_rules()->BeginReceiveCallerOwned(
serialized_[i].inner_->GetIncompleteVar(),
- serialized_[i].inner_->GetStringPtr()));
+ serialized_[i].inner_->GetStringPtr(),
+ dispatcher));
deserialized_[i] = serialized_[i].inner_->GetVar();
}
@@ -390,14 +394,14 @@ void SerializedVarReturnValue::Return(Dispatcher* dispatcher,
const PP_Var& var) {
serialized_->inner_->set_serialization_rules(
dispatcher->serialization_rules());
- serialized_->inner_->SetVar(var);
// Var must clean up after our BeginSendPassRef call.
serialized_->inner_->set_cleanup_mode(SerializedVar::END_SEND_PASS_REF);
- dispatcher->serialization_rules()->BeginSendPassRef(
- serialized_->inner_->GetIncompleteVar(),
- serialized_->inner_->GetStringPtr());
+ serialized_->inner_->SetVar(
+ dispatcher->serialization_rules()->BeginSendPassRef(
+ var,
+ serialized_->inner_->GetStringPtr()));
}
// SerializedVarOutParam -------------------------------------------------------
@@ -411,9 +415,9 @@ SerializedVarOutParam::~SerializedVarOutParam() {
if (serialized_->inner_->serialization_rules()) {
// When unset, OutParam wasn't called. We'll just leave the var untouched
// in that case.
- serialized_->inner_->SetVar(writable_var_);
- serialized_->inner_->serialization_rules()->BeginSendPassRef(
- writable_var_, serialized_->inner_->GetStringPtr());
+ serialized_->inner_->SetVar(
+ serialized_->inner_->serialization_rules()->BeginSendPassRef(
+ writable_var_, serialized_->inner_->GetStringPtr()));
// Normally the current object will be created on the stack to wrap a
// SerializedVar and won't have a scope around the actual IPC send. So we