Bug 1187088 - Use UNIFIED_SOURCES in widget/android; r=snorp
authorJim Chen <nchen@mozilla.com>
Tue, 04 Aug 2015 17:47:28 -0400
changeset 287892 d2eaeb3217f43f87c4d5b10a85ef7fb2b4d04ac6
parent 287891 a9b044bd018a4e4f9a10466f47aa24b6574a8c4a
child 287893 20a9ea2255877e3697c4838eb372b3fe8bc8fc54
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1187088
milestone42.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 1187088 - Use UNIFIED_SOURCES in widget/android; r=snorp Fix some compiling errors in unified mode due to header dependency issues.
widget/android/AndroidBridge.cpp
widget/android/AndroidGraphicBuffer.cpp
widget/android/AndroidJNI.cpp
widget/android/jni/moz.build
widget/android/moz.build
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -1,19 +1,20 @@
 /* -*- 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/. */
 
-#include "mozilla/layers/CompositorChild.h"
-#include "mozilla/layers/CompositorParent.h"
-
 #include <android/log.h>
 #include <dlfcn.h>
 #include <math.h>
+#include <GLES2/gl2.h>
+
+#include "mozilla/layers/CompositorChild.h"
+#include "mozilla/layers/CompositorParent.h"
 
 #include "mozilla/Hal.h"
 #include "nsXULAppAPI.h"
 #include <prthread.h>
 #include "nsXPCOMStrings.h"
 #include "AndroidBridge.h"
 #include "AndroidJNIWrapper.h"
 #include "AndroidBridgeUtilities.h"
--- a/widget/android/AndroidGraphicBuffer.cpp
+++ b/widget/android/AndroidGraphicBuffer.cpp
@@ -4,33 +4,33 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <dlfcn.h>
 #include <android/log.h>
 #include <GLES2/gl2.h>
 #include <nsTArray.h>
 #include "AndroidGraphicBuffer.h"
 #include "AndroidBridge.h"
+#include "GLTypes.h"
 #include "mozilla/Preferences.h"
 
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "AndroidGraphicBuffer" , ## args)
 
 #define EGL_NATIVE_BUFFER_ANDROID 0x3140
 #define EGL_IMAGE_PRESERVED_KHR   0x30D2
 
 typedef void *EGLContext;
 typedef void *EGLDisplay;
 typedef uint32_t EGLenum;
 typedef int32_t EGLint;
 typedef uint32_t EGLBoolean;
 
 #define EGL_TRUE 1
 #define EGL_FALSE 0
 #define EGL_NONE 0x3038
-#define EGL_NO_CONTEXT (EGLContext)0
 #define EGL_DEFAULT_DISPLAY  (void*)0
 
 #define ANDROID_LIBUI_PATH "libui.so"
 #define ANDROID_GLES_PATH "libGLESv2.so"
 #define ANDROID_EGL_PATH "libEGL.so"
 
 // Really I have no idea, but this should be big enough
 #define GRAPHIC_BUFFER_SIZE 1024
--- a/widget/android/AndroidJNI.cpp
+++ b/widget/android/AndroidJNI.cpp
@@ -25,16 +25,17 @@
 #include "nsThreadUtils.h"
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsICrashReporter.h"
 #include "nsExceptionHandler.h"
 #endif
 
 #include "mozilla/unused.h"
+#include "mozilla/MathAlgorithms.h"
 #include "mozilla/UniquePtr.h"
 
 #include "mozilla/dom/SmsMessage.h"
 #include "mozilla/dom/mobilemessage/Constants.h"
 #include "mozilla/dom/mobilemessage/Types.h"
 #include "mozilla/dom/mobilemessage/PSms.h"
 #include "mozilla/dom/mobilemessage/SmsParent.h"
 #include "mozilla/layers/APZCTreeManager.h"
@@ -701,30 +702,16 @@ Java_org_mozilla_gecko_GeckoAppShell_not
     };
     nsString path = nsJNIString(filePath, jenv);
     
     nsCOMPtr<nsIRunnable> runnable =
         new NotifyFilePickerResultRunnable(path, (long)callback);
     NS_DispatchToMainThread(runnable);
 }
 
-static int
-NextPowerOfTwo(int value) {
-    // code taken from http://acius2.blogspot.com/2007/11/calculating-next-power-of-2.html
-    if (0 == value--) {
-        return 1;
-    }
-    value = (value >> 1) | value;
-    value = (value >> 2) | value;
-    value = (value >> 4) | value;
-    value = (value >> 8) | value;
-    value = (value >> 16) | value;
-    return value + 1;
-}
-
 #define MAX_LOCK_ATTEMPTS 10
 
 static bool LockWindowWithRetry(void* window, unsigned char** bits, int* width, int* height, int* format, int* stride)
 {
   int count = 0;
 
   while (count < MAX_LOCK_ATTEMPTS) {
       if (AndroidBridge::Bridge()->LockWindow(window, bits, width, height, format, stride))
@@ -773,18 +760,18 @@ Java_org_mozilla_gecko_GeckoAppShell_get
         break;
     case 4: // RGB_565
         bpp = 2;
         break;
     default:
         goto cleanup;
     }
 
-    dstWidth = NextPowerOfTwo(srcWidth);
-    dstHeight = NextPowerOfTwo(srcHeight);
+    dstWidth = mozilla::RoundUpPow2(srcWidth);
+    dstHeight = mozilla::RoundUpPow2(srcHeight);
     dstSize = dstWidth * dstHeight * bpp;
 
     bitsCopy = (unsigned char*)malloc(dstSize);
     bzero(bitsCopy, dstSize);
     for (int i = 0; i < srcHeight; i++) {
         memcpy(bitsCopy + ((dstHeight - i - 1) * dstWidth * bpp), bits + (i * srcStride * bpp), srcStride * bpp);
     }
     
--- a/widget/android/jni/moz.build
+++ b/widget/android/jni/moz.build
@@ -7,17 +7,17 @@
 EXPORTS.mozilla.jni += [
     'Accessors.h',
     'Natives.h',
     'Refs.h',
     'Types.h',
     'Utils.h',
 ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'Utils.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
--- a/widget/android/moz.build
+++ b/widget/android/moz.build
@@ -17,17 +17,17 @@ XPIDL_MODULE = 'widget_android'
 
 EXPORTS += [
     'AndroidBridge.h',
     'AndroidJavaWrappers.h',
     'AndroidJNIWrapper.h',
     'GeneratedJNIWrappers.h',
 ]
 
-SOURCES += [
+UNIFIED_SOURCES += [
     'AndroidBridge.cpp',
     'AndroidContentController.cpp',
     'AndroidDirectTexture.cpp',
     'AndroidGraphicBuffer.cpp',
     'AndroidJavaWrappers.cpp',
     'AndroidJNI.cpp',
     'AndroidJNIWrapper.cpp',
     'ANRReporter.cpp',