Closed Bug 1189881 Opened 10 years ago Closed 9 years ago

Move GeckoJavaSampler.getProfilerTime out of AndroidJNI.cpp

Categories

(Core Graveyard :: Widget: Android, defect)

All
Android
defect
Not set
normal

Tracking

(firefox43 fixed)

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: jchen, Assigned: droeh)

References

Details

Attachments

(1 file, 6 obsolete files)

Similar to bug 1182641 and bug 1186467, we want to move GeckoJavaSampler.getProfilerTime out of AndroidJNI.cpp and into an appropriate class.
Assignee: nobody → droeh
Attached patch Incomplete patch (obsolete) — Splinter Review
Jim, can you take a look at this when you've got a moment? Thanks.
Flags: needinfo?(nchen)
Attached patch Proposed Patch (obsolete) — Splinter Review
Moves GeckoJavaSampler.getProfilerTime to GeckoJavaSampler.h/cpp
Attachment #8652515 - Attachment is obsolete: true
Attachment #8652944 - Flags: review?(snorp)
Attachment #8652944 - Flags: review?(snorp) → review?(nchen)
Comment on attachment 8652944 [details] [diff] [review] Proposed Patch Review of attachment 8652944 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, but I didn't see the GeckoJavaSampler.h/cpp changes. Did you mean to include those as well?
Attachment #8652944 - Flags: review?(nchen) → feedback+
Flags: needinfo?(nchen)
Attached patch Proposed patch (updated) (obsolete) — Splinter Review
Yep, missed GeckoJavaSampler.h/cpp in that last patch. This one should be good.
Attachment #8652944 - Attachment is obsolete: true
Attachment #8653019 - Flags: review?(nchen)
Comment on attachment 8653019 [details] [diff] [review] Proposed patch (updated) Review of attachment 8653019 [details] [diff] [review]: ----------------------------------------------------------------- Getting there! Like I said on IRC yesterday, I think we should move the GeckoJavaSampler implementation to under tools/profiler/, maybe inside tools/profiler/core/platform.cpp. Then you can call GeckoJavaSampler::Init from inside mozilla_sampler_init. Just remember to put | #ifdef SPS_OS_android | around everything. [1] http://mxr.mozilla.org/mozilla-central/source/tools/profiler/core/platform.cpp?rev=fea87cbeaa6b#434
Attachment #8653019 - Flags: review?(nchen) → feedback+
I actually looked into doing that, but the problem I ran into was that in order to call mozilla::GeckoJavaSampler::Init() in nsAppShell.cpp, I would have to include tools/profiler/core/platform.h (or something that includes that), which creates competing definitions of Mutex and MutexAutoLock in nsAppShell (the other definitions being from xpcom/glue/Mutex.h). I didn't see an easy way around this, but if you've got a suggestion I'm open to try it.
Flags: needinfo?(nchen)
You don't have to call GeckoJavaSampler::Init() in nsAppShell.cpp. Instead, you can call it inside mozilla_sampler_init, which is inside platform.cpp. So everything can go inside platform.cpp; you don't even need to touch platform.h.
Flags: needinfo?(nchen)
Attached patch Proposed patch (updated) (obsolete) — Splinter Review
Alright, thanks Jim. Here's a patch that handles it that way.
Attachment #8653019 - Attachment is obsolete: true
Attachment #8654128 - Flags: review?(nchen)
Comment on attachment 8654128 [details] [diff] [review] Proposed patch (updated) Review of attachment 8654128 [details] [diff] [review]: ----------------------------------------------------------------- ::: tools/profiler/core/platform.cpp @@ +58,5 @@ > + static double GetProfilerTime(); > +}; > + > +double > +GeckoJavaSampler::GetProfilerTime() { You can just put the function inside the class declaration. And you don't really need the mozilla namespace for GeckoJavaSampler. @@ +522,5 @@ > > const char* threadFilters[] = { "GeckoMain", "Compositor" }; > > +#ifdef SPS_OS_android > + mozilla::GeckoJavaSampler::Init(); You have to move this to above the line > const char *val = getenv("MOZ_PROFILER_STARTUP"); Because otherwise it won't run unless the MOZ_PROFILER_STARTUP env var is eet. ::: tools/profiler/moz.build @@ +89,5 @@ > '/mozglue/linker', > '/toolkit/crashreporter/google-breakpad/src', > '/tools/profiler/core/', > '/tools/profiler/gecko/', > + '/widget/android', Instead of this, can you add "GeneratedJNINatives.h" under EXPORTS in widget/android/moz.build?
Attachment #8654128 - Flags: review?(nchen) → feedback+
Attached patch Proposed patch (updated) (obsolete) — Splinter Review
Now with recommended changes.
Attachment #8654128 - Attachment is obsolete: true
Attachment #8654197 - Flags: review?(nchen)
Comment on attachment 8654197 [details] [diff] [review] Proposed patch (updated) Review of attachment 8654197 [details] [diff] [review]: ----------------------------------------------------------------- Looks good! Thanks! Adding BenWa to rubber stamp the tools/profiler changes.
Attachment #8654197 - Flags: review?(nchen)
Attachment #8654197 - Flags: review?(bgirard)
Attachment #8654197 - Flags: review+
Comment on attachment 8654197 [details] [diff] [review] Proposed patch (updated) Review of attachment 8654197 [details] [diff] [review]: ----------------------------------------------------------------- Thanks!
Attachment #8654197 - Flags: review?(bgirard) → review+
Attached patch Proposed patch (updated) (obsolete) — Splinter Review
Updated to fix test breakage. Carry over jchen's r+.
Attachment #8654197 - Attachment is obsolete: true
Attachment #8661786 - Flags: review+
Keywords: checkin-needed
sorry had to back this out since this caused a bustage on b2g like https://treeherder.mozilla.org/logviewer.html#?job_id=14257056&repo=mozilla-inbound
Flags: needinfo?(droeh)
Fixed b2g build breakage. Carry over jchen's r+. https://treeherder.mozilla.org/#/jobs?repo=try&revision=08000315018b
Attachment #8661786 - Attachment is obsolete: true
Flags: needinfo?(droeh)
Attachment #8662955 - Flags: review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: