Bug 1030245 - When dumping the layers dump, ensure up to 1024 characters of each line in the dump is output. r=BenWa
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 03 Jul 2014 09:09:24 -0400
changeset 212995 79c4e94e19b2ec8ba378d5d8e952c5b6fa799f1d
parent 212994 e7979b75c4640b23f9dc1d1b49d229671f0ebab5
child 212996 6b16d520f752b6f544aab0540d8ed980599f0844
push id3857
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:39:23 +0000
treeherdermozilla-beta@5638b907b505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa
bugs1030245
milestone33.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 1030245 - When dumping the layers dump, ensure up to 1024 characters of each line in the dump is output. r=BenWa
gfx/layers/Layers.h
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -563,17 +563,26 @@ public:
   void Dump(std::stringstream& aStream, const char* aPrefix="", bool aDumpHtml=false);
   /**
    * Dump information about just this layer manager itself to aStream
    */
   void DumpSelf(std::stringstream& aStream, const char* aPrefix="");
   void Dump() {
     std::stringstream ss;
     Dump(ss);
-    printf_stderr("%s", ss.str().c_str());
+    char line[1024];
+    while (!ss.eof()) {
+      ss.getline(line, sizeof(line));
+      printf_stderr("%s", line);
+      if (ss.fail()) {
+        // line was too long, skip to next newline
+        ss.clear();
+        ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+      }
+    }
   }
 
   /**
    * Log information about this layer manager and its managed tree to
    * the NSPR log (if enabled for "Layers").
    */
   void Log(const char* aPrefix="");
   /**