Bug 1303806 - 3. Update sources to reflect new bindings; r=snorp r=nalexander
authorJim Chen <nchen@mozilla.com>
Tue, 20 Sep 2016 17:42:08 -0400
changeset 314548 005bf983f9e34c0e905830bddb4e54e9a1e1b7c1
parent 314547 6291e10b1bdbcd917cdd2f21c9193707d967516d
child 314549 c9f2cb674778ded355d16e6d06f2fa22b49e99b3
push id81925
push usernchen@mozilla.com
push dateTue, 20 Sep 2016 21:42:28 +0000
treeherdermozilla-inbound@005bf983f9e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, nalexander
bugs1303806
milestone52.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 1303806 - 3. Update sources to reflect new bindings; r=snorp r=nalexander Update #includes to use new headers if necessary. Also remove a couple of functions in AndroidBridge to clean up the code.
tools/profiler/core/GeckoSampler.cpp
tools/profiler/core/platform.cpp
widget/android/ANRReporter.h
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
--- a/tools/profiler/core/GeckoSampler.cpp
+++ b/tools/profiler/core/GeckoSampler.cpp
@@ -40,17 +40,17 @@
 #include "mozilla/Services.h"
 #include "PlatformMacros.h"
 #include "nsTArray.h"
 
 #include "mozilla/ProfileGatherer.h"
 #endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
-  #include "AndroidBridge.h"
+  #include "FennecJNIWrappers.h"
 #endif
 
 #ifndef SPS_STANDALONE
 // JS
 #include "jsfriendapi.h"
 #include "js/ProfilingFrameIterator.h"
 #endif
 
@@ -464,20 +464,20 @@ void BuildJavaThreadJSObject(SpliceableJ
 
   aWriter.StartArrayProperty("samples");
 
     // for each sample
     for (int sampleId = 0; true; sampleId++) {
       bool firstRun = true;
       // for each frame
       for (int frameId = 0; true; frameId++) {
-        nsCString result;
-        bool hasFrame = AndroidBridge::Bridge()->GetFrameNameJavaProfiling(0, sampleId, frameId, result);
+        jni::String::LocalRef frameName =
+            java::GeckoJavaSampler::GetFrameName(0, sampleId, frameId);
         // when we run out of frames, we stop looping
-        if (!hasFrame) {
+        if (!frameName) {
           // if we found at least one frame, we have objects to close
           if (!firstRun) {
               aWriter.EndArray();
             aWriter.EndObject();
           }
           break;
         }
         // the first time around, open the sample object and frames array
@@ -489,17 +489,18 @@ void BuildJavaThreadJSObject(SpliceableJ
 
           aWriter.StartObjectElement();
             aWriter.DoubleProperty("time", sampleTime);
 
             aWriter.StartArrayProperty("frames");
         }
         // add a frame to the sample
         aWriter.StartObjectElement();
-          aWriter.StringProperty("location", result.BeginReading());
+          aWriter.StringProperty("location",
+                                 frameName->ToCString().BeginReading());
         aWriter.EndObject();
       }
       // if we found no frames for this sample, we are done
       if (firstRun) {
         break;
       }
     }
 
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -31,21 +31,21 @@
 #endif
 #include "ProfilerMarkers.h"
 
 #ifdef MOZ_TASK_TRACER
 #include "GeckoTaskTracer.h"
 #endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
-  #include "GeneratedJNIWrappers.h"
+  #include "FennecJNIWrappers.h"
 #endif
 
 #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
-#include "GeneratedJNINatives.h"
+#include "FennecJNINatives.h"
 #endif
 
 #ifndef SPS_STANDALONE
 #if defined(SPS_PLAT_amd64_linux) || defined(SPS_PLAT_x86_linux)
 # define USE_LUL_STACKWALK
 # include "lul/LulMain.h"
 # include "lul/platform-linux-lul.h"
 #endif
--- a/widget/android/ANRReporter.h
+++ b/widget/android/ANRReporter.h
@@ -1,17 +1,17 @@
 /* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef ANRReporter_h__
 #define ANRReporter_h__
 
-#include "GeneratedJNINatives.h"
+#include "FennecJNINatives.h"
 
 namespace mozilla {
 
 class ANRReporter : public java::ANRReporter::Natives<ANRReporter>
 {
 private:
     ANRReporter();
 
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -1334,42 +1334,16 @@ NS_IMETHODIMP nsAndroidBridge::SetBrowse
     return NS_OK;
 }
 
 extern "C"
 __attribute__ ((visibility("default")))
 jobject JNICALL
 Java_org_mozilla_gecko_GeckoAppShell_allocateDirectBuffer(JNIEnv *env, jclass, jlong size);
 
-bool
-AndroidBridge::GetThreadNameJavaProfiling(uint32_t aThreadId, nsCString & aResult)
-{
-    auto jstrThreadName = GeckoJavaSampler::GetThreadName(aThreadId);
-
-    if (!jstrThreadName)
-        return false;
-
-    aResult = jstrThreadName->ToCString();
-    return true;
-}
-
-bool
-AndroidBridge::GetFrameNameJavaProfiling(uint32_t aThreadId, uint32_t aSampleId,
-                                          uint32_t aFrameId, nsCString & aResult)
-{
-    auto jstrSampleName = GeckoJavaSampler::GetFrameName
-            (aThreadId, aSampleId, aFrameId);
-
-    if (!jstrSampleName)
-        return false;
-
-    aResult = jstrSampleName->ToCString();
-    return true;
-}
-
 void
 AndroidBridge::ContentDocumentChanged()
 {
     if (!mLayerClient) {
         return;
     }
     mLayerClient->ContentDocumentChanged();
 }
--- a/widget/android/AndroidBridge.h
+++ b/widget/android/AndroidBridge.h
@@ -139,20 +139,16 @@ public:
 
     static void ConstructBridge();
     static void DeconstructBridge();
 
     static AndroidBridge *Bridge() {
         return sBridge;
     }
 
-    /* These are all implemented in Java */
-    bool GetThreadNameJavaProfiling(uint32_t aThreadId, nsCString & aResult);
-    bool GetFrameNameJavaProfiling(uint32_t aThreadId, uint32_t aSampleId, uint32_t aFrameId, nsCString & aResult);
-
     void ContentDocumentChanged();
     bool IsContentDocumentDisplayed();
 
     void SetLayerClient(java::GeckoLayerClient::Param jobj);
     const java::GeckoLayerClient::Ref& GetLayerClient() { return mLayerClient; }
 
     bool GetHandlersForURL(const nsAString& aURL,
                            nsIMutableArray* handlersArray = nullptr,