Bug 734302 - Part 3: Add a menu item for toggling the profiler on mobile; r=BenWa,dougt

--HG--
rename : mobile/android/base/resources/menu-v11/gecko_menu.xml => mobile/android/base/resources/menu-v11/gecko_menu.xml.in
rename : mobile/android/base/resources/menu/gecko_menu.xml => mobile/android/base/resources/menu/gecko_menu.xml.in
extra : rebase_source : 9a4499ff99d661924e1eb09280925ad123ecd948
This commit is contained in:
Ehsan Akhgari 2012-03-16 14:08:03 -04:00
parent 9aac7ab107
commit 29d313feed
9 changed files with 31 additions and 12 deletions

View File

@ -236,6 +236,7 @@
@BINPATH@/components/pref.xpt
@BINPATH@/components/prefetch.xpt
@BINPATH@/components/profile.xpt
@BINPATH@/components/profiler.xpt
@BINPATH@/components/proxyObject.xpt
@BINPATH@/components/rdf.xpt
@BINPATH@/components/satchel.xpt

View File

@ -533,6 +533,9 @@ abstract public class GeckoApp
case R.id.char_encoding:
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("CharEncoding:Get", null));
return true;
case R.id.toggle_profiling:
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("ToggleProfiling", null));
return true;
default:
return super.onOptionsItemSelected(item);
}

View File

@ -173,6 +173,8 @@ FENNEC_PP_JAVA_FILES = \
FENNEC_PP_XML_FILES = \
res/layout/abouthome_content.xml \
res/menu/gecko_menu.xml \
res/menu-v11/gecko_menu.xml \
$(NULL)
@ -525,11 +527,6 @@ RES_COLOR = \
RES_MENU = \
res/menu/awesomebar_contextmenu.xml \
res/menu/gecko_menu.xml \
$(NULL)
RES_MENU_V11 = \
res/menu-v11/gecko_menu.xml \
$(NULL)
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
@ -592,7 +589,7 @@ MOZ_ANDROID_DRAWABLES += \
MOZ_ANDROID_DRAWABLES += $(shell if test -e $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn; then cat $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/android-resources.mn | tr '\n' ' '; fi)
RESOURCES=$(RES_LAYOUT) $(RES_LAYOUT_V11) $(RES_LAYOUT_LAND_V14) $(RES_VALUES) $(RES_VALUES_V11) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_NODPI) $(RES_DRAWABLE_BASE) $(RES_DRAWABLE_LDPI) $(RES_DRAWABLE_HDPI) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_COLOR) $(RES_MENU) $(RES_MENU_V11)
RESOURCES=$(RES_LAYOUT) $(RES_LAYOUT_V11) $(RES_LAYOUT_LAND_V14) $(RES_VALUES) $(RES_VALUES_V11) $(RES_XML) $(RES_ANIM) $(RES_DRAWABLE_NODPI) $(RES_DRAWABLE_BASE) $(RES_DRAWABLE_LDPI) $(RES_DRAWABLE_HDPI) $(RES_DRAWABLE_MDPI_V11) $(RES_DRAWABLE_HDPI_V11) $(RES_DRAWABLE_XHDPI_V11) $(RES_DRAWABLE_LAND_MDPI_V14) $(RES_DRAWABLE_LAND_HDPI_V14) $(RES_DRAWABLE_LAND_XHDPI_V14) $(RES_COLOR) $(RES_MENU)
RES_DIRS= \
res/layout \
@ -617,6 +614,7 @@ RES_DIRS= \
res/drawable-land-xhdpi-v14 \
res/color \
res/menu \
res/menu-v11 \
$(NULL)

View File

@ -37,6 +37,11 @@
<item android:id="@+id/settings"
android:title="@string/settings" />
#ifdef MOZ_PROFILING
<item android:id="@+id/toggle_profiling"
android:title="@string/toggle_profiling" />
#endif
<item android:id="@+id/quit"
android:title="@string/quit"
android:orderInCategory="10" />

View File

@ -38,6 +38,11 @@
<item android:id="@+id/settings"
android:title="@string/settings" />
#ifdef MOZ_PROFILING
<item android:id="@+id/toggle_profiling"
android:title="@string/toggle_profiling" />
#endif
<item android:id="@+id/quit"
android:title="@string/quit"
android:orderInCategory="10" />

View File

@ -88,6 +88,9 @@
<string name="addons">&addons;</string>
<string name="downloads">&downloads;</string>
<string name="char_encoding">&char_encoding;</string>
<!-- This string only appears in developer builds, which
is why it is not localizable. -->
<string name="toggle_profiling">Toggle Profiling</string>
<string name="site_settings_title">&site_settings_title;</string>
<string name="site_settings_cancel">&site_settings_cancel;</string>

View File

@ -193,6 +193,7 @@ var BrowserApp = {
Services.obs.addObserver(this, "Viewport:Change", false);
Services.obs.addObserver(this, "Passwords:Init", false);
Services.obs.addObserver(this, "FormHistory:Init", false);
Services.obs.addObserver(this, "ToggleProfiling", false);
Services.obs.addObserver(this, "sessionstore-state-purge-complete", false);
@ -951,6 +952,14 @@ var BrowserApp = {
Services.obs.removeObserver(this, "FormHistory:Init", false);
} else if (aTopic == "sessionstore-state-purge-complete") {
sendMessageToJava({ gecko: { type: "Session:StatePurged" }});
} else if (aTopic == "ToggleProfiling") {
let profiler = Cc["@mozilla.org/tools/profiler;1"].
getService(Ci.nsIProfiler);
if (profiler.IsActive()) {
profiler.StopProfiler();
} else {
profiler.StartProfiler(100000, 25, ["stackwalk"], 1);
}
}
},

View File

@ -231,6 +231,7 @@
@BINPATH@/components/pref.xpt
@BINPATH@/components/prefetch.xpt
@BINPATH@/components/profile.xpt
@BINPATH@/components/profiler.xpt
@BINPATH@/components/proxyObject.xpt
@BINPATH@/components/rdf.xpt
@BINPATH@/components/satchel.xpt

View File

@ -353,13 +353,7 @@ class TableTicker: public Sampler {
, mPrimaryThreadProfile(aEntrySize, aStack)
, mSaveRequested(false)
{
#if defined(USE_LIBUNWIND) && defined(ANDROID)
// We don't have the Gecko Profiler add-on on Android, but we know that
// libunwind is available, so we can always walk the stacks.
mUseStackWalk = true;
#else
mUseStackWalk = hasFeature(aFeatures, aFeatureCount, "stackwalk");
#endif
//XXX: It's probably worth splitting the jank profiler out from the regular profiler at some point
mJankOnly = hasFeature(aFeatures, aFeatureCount, "jank");