Commit 1cd88924 authored by koz@chromium.org's avatar koz@chromium.org

Revert 180093

> PPAPI: Fix WebSocket Var ref leak receiving binary
> 
> BUG=173503
> 
> 
> Review URL: https://chromiumcodereview.appspot.com/12096099

This seems to have broken WebSocket tests on the mac bots
http://build.chromium.org/p/chromium.mac/builders/Mac10.6%20Tests%20%281%29/builds/35419
http://build.chromium.org/p/chromium.mac/builders/Mac10.7%20Tests%20%281%29/builds/7829

TBR=dmichael@chromium.org
Review URL: https://codereview.chromium.org/12096107

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180105 0039d316-1c4b-4281-b951-d872f2087c98
parent 63f2720b
......@@ -423,10 +423,10 @@ void WebSocketResource::OnPluginMsgReceiveBinaryReply(
return;
// Append received data to queue.
scoped_refptr<Var> message_var(
PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferVar(
scoped_refptr<Var> message_var(ArrayBufferVar::FromPPVar(
PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
message.size(),
&message.front()));
&message.front())));
received_messages_.push(message_var);
if (!TrackedCallback::IsPending(receive_callback_))
......
......@@ -186,18 +186,13 @@ PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes) {
PP_Var VarTracker::MakeArrayBufferPPVar(uint32 size_in_bytes,
const void* data) {
ArrayBufferVar* array_buffer = MakeArrayBufferVar(size_in_bytes, data);
return array_buffer ? array_buffer->GetPPVar() : PP_MakeNull();
}
ArrayBufferVar* VarTracker::MakeArrayBufferVar(uint32 size_in_bytes,
const void* data) {
DCHECK(CalledOnValidThread());
ArrayBufferVar* array_buffer(CreateArrayBuffer(size_in_bytes));
scoped_refptr<ArrayBufferVar> array_buffer(CreateArrayBuffer(size_in_bytes));
if (!array_buffer)
return NULL;
return PP_MakeNull();
memcpy(array_buffer->Map(), data, size_in_bytes);
return array_buffer;
return array_buffer->GetPPVar();
}
std::vector<PP_Var> VarTracker::GetLiveVars() {
......
......@@ -73,12 +73,6 @@ class PPAPI_SHARED_EXPORT VarTracker
// Same as above, but copy the contents of |data| in to the new array buffer.
PP_Var MakeArrayBufferPPVar(uint32 size_in_bytes, const void* data);
// Create an ArrayBuffer and copy the contents of |data| in to it. The
// returned object has 0 reference count in the tracker, and like all
// RefCounted objects, has a 0 initial internal reference count. (You should
// usually immediately put this in a scoped_refptr).
ArrayBufferVar* MakeArrayBufferVar(uint32 size_in_bytes, const void* data);
// Return a vector containing all PP_Vars that are in the tracker. This is
// to help implement PPB_Testing_Dev.GetLiveVars and should generally not be
// used in production code. The PP_Vars are returned in no particular order,
......
......@@ -313,7 +313,7 @@ class TestCaseFactory {
instance_->pp_instance()) != objects) \
error_message = MakeFailureMessage(__FILE__, __LINE__, \
"reference leak check"); \
instance_->LogTest(#name, CheckResourcesAndVars(error_message)); \
instance_->LogTest(#name, error_message); \
}
// Helper macros for checking values in tests, and returning a location
......
......@@ -464,7 +464,6 @@ std::string TestWebSocket::TestValidConnect() {
PP_Var extensions = websocket_interface_->GetExtensions(ws);
ASSERT_TRUE(AreEqualWithString(extensions, ""));
core_interface_->ReleaseResource(ws);
ReleaseVar(extensions);
PASS();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment