Bug 1112747 - Change mozilla::plugins::IPCByteRanges from std::vector to nsTArray. r=jimm
authorJed Davis <jld@mozilla.com>
Wed, 17 Dec 2014 12:57:00 -0500
changeset 220310 ad79358ea0e0cdc3c9984086b1c05e35d9632eab
parent 220309 e54532e910348fdde4deca1710f918227d03297d
child 220311 ce7402c3a5a205dcff32b9e375ecd8ed25029b1f
push id27983
push usercbook@mozilla.com
push dateThu, 18 Dec 2014 12:51:14 +0000
treeherdermozilla-central@9bb8b0b4daae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1112747
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1112747 - Change mozilla::plugins::IPCByteRanges from std::vector to nsTArray. r=jimm
dom/plugins/ipc/BrowserStreamChild.cpp
dom/plugins/ipc/BrowserStreamParent.cpp
dom/plugins/ipc/PluginMessageUtils.h
--- a/dom/plugins/ipc/BrowserStreamChild.cpp
+++ b/dom/plugins/ipc/BrowserStreamChild.cpp
@@ -166,17 +166,17 @@ BrowserStreamChild::NPN_RequestRead(NPBy
   AssertPluginThread();
 
   if (ALIVE != mState || kStreamOpen != mStreamStatus)
     return NPERR_GENERIC_ERROR;
 
   IPCByteRanges ranges;
   for (; aRangeList; aRangeList = aRangeList->next) {
     IPCByteRange br = {aRangeList->offset, aRangeList->length};
-    ranges.push_back(br);
+    ranges.AppendElement(br);
   }
 
   NPError result;
   CallNPN_RequestRead(ranges, &result);
   return result;
 }
 
 void
--- a/dom/plugins/ipc/BrowserStreamParent.cpp
+++ b/dom/plugins/ipc/BrowserStreamParent.cpp
@@ -53,26 +53,26 @@ BrowserStreamParent::AnswerNPN_RequestRe
   default:
     NS_ERROR("Unexpected state");
     return false;
   }
 
   if (!mStream)
     return false;
 
-  if (ranges.size() > INT32_MAX)
+  if (ranges.Length() > INT32_MAX)
     return false;
 
-  nsAutoArrayPtr<NPByteRange> rp(new NPByteRange[ranges.size()]);
-  for (uint32_t i = 0; i < ranges.size(); ++i) {
+  nsAutoArrayPtr<NPByteRange> rp(new NPByteRange[ranges.Length()]);
+  for (uint32_t i = 0; i < ranges.Length(); ++i) {
     rp[i].offset = ranges[i].offset;
     rp[i].length = ranges[i].length;
     rp[i].next = &rp[i + 1];
   }
-  rp[ranges.size() - 1].next = nullptr;
+  rp[ranges.Length() - 1].next = nullptr;
 
   *result = mNPP->mNPNIface->requestread(mStream, rp);
   return true;
 }
 
 bool
 BrowserStreamParent::RecvNPN_DestroyStream(const NPReason& reason)
 {
--- a/dom/plugins/ipc/PluginMessageUtils.h
+++ b/dom/plugins/ipc/PluginMessageUtils.h
@@ -70,17 +70,17 @@ extern PRLogModuleInfo* GetPluginLog();
  * This is NPByteRange without the linked list.
  */
 struct IPCByteRange
 {
   int32_t offset;
   uint32_t length;
 };  
 
-typedef std::vector<IPCByteRange> IPCByteRanges;
+typedef nsTArray<IPCByteRange> IPCByteRanges;
 
 typedef nsCString Buffer;
 
 struct NPRemoteWindow
 {
   NPRemoteWindow();
   uint64_t window;
   int32_t x;