Bug 916607 - 3/4: android backend. r=blassey
authorVicamo Yang <vyang@mozilla.com>
Mon, 04 Aug 2014 17:01:36 +0800
changeset 197444 e2d5cf427ed419d2718647fa4bd70fd4f34e1277
parent 197443 93cf77271f0f1c56d21af600849a5819f93788b0
child 197445 f70489df95a6dd03f3c8ba7bd448ef527da86bf1
push id9417
push uservyang@mozilla.com
push dateMon, 04 Aug 2014 09:01:50 +0000
treeherderb2g-inbound@f70489df95a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs916607
milestone34.0a1
Bug 916607 - 3/4: android backend. r=blassey
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -1060,48 +1060,45 @@ nsresult
 AndroidBridge::GetSegmentInfoForText(const nsAString& aText,
                                      nsIMobileMessageCallback* aRequest)
 {
 #ifndef MOZ_WEBSMS_BACKEND
     return NS_ERROR_FAILURE;
 #else
     ALOG_BRIDGE("AndroidBridge::GetSegmentInfoForText");
 
-    dom::mobilemessage::SmsSegmentInfoData data;
-
-    data.segments() = 0;
-    data.charsPerSegment() = 0;
-    data.charsAvailableInLastSegment() = 0;
+    int32_t segments, charsPerSegment, charsAvailableInLastSegment;
 
     JNIEnv *env = GetJNIEnv();
 
     AutoLocalJNIFrame jniFrame(env, 2);
     jstring jText = NewJavaString(&jniFrame, aText);
     jobject obj = env->CallStaticObjectMethod(mAndroidSmsMessageClass,
                                               jCalculateLength, jText, JNI_FALSE);
     if (jniFrame.CheckForException())
         return NS_ERROR_FAILURE;
 
     jintArray arr = static_cast<jintArray>(obj);
     if (!arr || env->GetArrayLength(arr) != 4)
         return NS_ERROR_FAILURE;
 
     jint* info = env->GetIntArrayElements(arr, JNI_FALSE);
 
-    data.segments() = info[0]; // msgCount
-    data.charsPerSegment() = info[2]; // codeUnitsRemaining
+    segments = info[0]; // msgCount
+    charsPerSegment = info[2]; // codeUnitsRemaining
     // segmentChars = (codeUnitCount + codeUnitsRemaining) / msgCount
-    data.charsAvailableInLastSegment() = (info[1] + info[2]) / info[0];
+    charsAvailableInLastSegment = (info[1] + info[2]) / info[0];
 
     env->ReleaseIntArrayElements(arr, info, JNI_ABORT);
 
     // TODO Bug 908598 - Should properly use |QueueSmsRequest(...)| to queue up
     // the nsIMobileMessageCallback just like other functions.
-    nsCOMPtr<nsIDOMMozSmsSegmentInfo> info = new SmsSegmentInfo(data);
-    return aRequest->NotifySegmentInfoForTextGot(info);
+    return aRequest->NotifySegmentInfoForTextGot(segments,
+                                                 charsPerSegment,
+                                                 charsAvailableInLastSegment);
 #endif
 }
 
 void
 AndroidBridge::SendMessage(const nsAString& aNumber,
                            const nsAString& aMessage,
                            nsIMobileMessageCallback* aRequest)
 {
--- a/widget/android/AndroidBridge.h
+++ b/widget/android/AndroidBridge.h
@@ -54,17 +54,16 @@ namespace mozilla {
 namespace hal {
 class BatteryInformation;
 class NetworkInformation;
 } // namespace hal
 
 namespace dom {
 namespace mobilemessage {
 struct SmsFilterData;
-struct SmsSegmentInfoData;
 } // namespace mobilemessage
 } // namespace dom
 
 namespace layers {
 class CompositorParent;
 } // namespace layers
 
 // The order and number of the members in this structure must correspond