Bug 1263235, part 4 - Make PBrowserStream::Write's data argument last. r=jimm, a=ritu
authorAndrew McCreight <continuation@gmail.com>
Sat, 09 Apr 2016 06:50:59 -0700
changeset 324099 bc49e5e68ab31c08db32f09824a7bb2c61b65a7b
parent 324098 846f5184333c6c3fa966454d741dcbbb058d65e5
child 324100 177a94ddc4b1dcef2fe0ca972adca94b5ab4497b
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, ritu
bugs1263235
milestone47.0a2
Bug 1263235, part 4 - Make PBrowserStream::Write's data argument last. r=jimm, a=ritu This will reduce internal memory fragmentation for the IPC::Message used to make this call.
dom/plugins/ipc/BrowserStreamChild.cpp
dom/plugins/ipc/BrowserStreamChild.h
dom/plugins/ipc/BrowserStreamParent.cpp
dom/plugins/ipc/PBrowserStream.ipdl
--- a/dom/plugins/ipc/BrowserStreamChild.cpp
+++ b/dom/plugins/ipc/BrowserStreamChild.cpp
@@ -76,18 +76,18 @@ BrowserStreamChild::StreamConstructed(
 
 BrowserStreamChild::~BrowserStreamChild()
 {
   NS_ASSERTION(!mStreamNotify, "Should have nulled it by now!");
 }
 
 bool
 BrowserStreamChild::RecvWrite(const int32_t& offset,
-                              const Buffer& data,
-                              const uint32_t& newlength)
+                              const uint32_t& newlength,
+                              const Buffer& data)
 {
   PLUGIN_LOG_DEBUG_FUNCTION;
 
   AssertPluginThread();
 
   if (ALIVE != mState)
     NS_RUNTIMEABORT("Unexpected state: received data after NPP_DestroyStream?");
 
--- a/dom/plugins/ipc/BrowserStreamChild.h
+++ b/dom/plugins/ipc/BrowserStreamChild.h
@@ -29,18 +29,18 @@ public:
   virtual bool IsBrowserStream() override { return true; }
 
   NPError StreamConstructed(
             const nsCString& mimeType,
             const bool& seekable,
             uint16_t* stype);
 
   virtual bool RecvWrite(const int32_t& offset,
-                         const Buffer& data,
-                         const uint32_t& newsize) override;
+                         const uint32_t& newsize,
+                         const Buffer& data) override;
   virtual bool RecvNPP_StreamAsFile(const nsCString& fname) override;
   virtual bool RecvNPP_DestroyStream(const NPReason& reason) override;
   virtual bool Recv__delete__() override;
 
   void EnsureCorrectInstance(PluginInstanceChild* i)
   {
     if (i != mInstance)
       NS_RUNTIMEABORT("Incorrect stream instance");
--- a/dom/plugins/ipc/BrowserStreamParent.cpp
+++ b/dom/plugins/ipc/BrowserStreamParent.cpp
@@ -188,18 +188,18 @@ BrowserStreamParent::Write(int32_t offse
 
   NS_ASSERTION(ALIVE == mState, "Sending data after NPP_DestroyStream?");
   NS_ASSERTION(len > 0, "Non-positive length to NPP_Write");
 
   if (len > kSendDataChunk)
     len = kSendDataChunk;
 
   return SendWrite(offset,
-                   nsCString(static_cast<char*>(buffer), len),
-                   mStream->end) ?
+                   mStream->end,
+                   nsCString(static_cast<char*>(buffer), len)) ?
     len : -1;
 }
 
 void
 BrowserStreamParent::StreamAsFile(const char* fname)
 {
   PLUGIN_LOG_DEBUG_FUNCTION;
 
--- a/dom/plugins/ipc/PBrowserStream.ipdl
+++ b/dom/plugins/ipc/PBrowserStream.ipdl
@@ -19,18 +19,18 @@ namespace plugins {
  * NPBrowserStream represents a NPStream sent from the browser to the plugin.
  */
 
 intr protocol PBrowserStream
 {
   manager PPluginInstance;
 
 child:
-  async Write(int32_t offset, Buffer data,
-              uint32_t newlength);
+  async Write(int32_t offset, uint32_t newlength,
+              Buffer data);
   async NPP_StreamAsFile(nsCString fname);
 
   /**
    * NPP_DestroyStream may race with other messages: the child acknowledges
    * the message with StreamDestroyed before this actor is deleted.
    */
   async NPP_DestroyStream(NPReason reason);
   async __delete__();