Commit Graph

10 Commits

Author SHA1 Message Date
Tadeu Zagallo e1fa325569 Change async events' cookie to NSUInteger
Summary: public

As jspahrsumemrs pointed out, `int` could overflow pretty easy, since it was static,
change it to an NSUInteger and downcast it when need to interop.

Reviewed By: jspahrsummers

Differential Revision: D2625902

fb-gh-sync-id: 2052be47a7b0ed81484da004fa18d6ef5baf26f7
2015-11-08 10:20:29 -08:00
Tadeu Zagallo 1f0d48a0e4 Guard from hooking modules twice
Summary: public

The dev menu is a little bit flaky right now, and sometimes it emits messages twice,
so guard it not to hook into the modules twice.

Reviewed By: jspahrsummers

Differential Revision: D2625911

fb-gh-sync-id: 18fd6bc00e473ed226291e7aca4a02cec84bfc8f
2015-11-07 13:47:27 -08:00
Tadeu Zagallo 0c74804427 Use dispatch_async instead of lock
Summary: public

The initial implementation used a lock to manage the stored profile information,
blocking the caller thread for longer than it should. Replace it with a private
queue, since the only thing we need to from the caller is to record the immediate
call time and the caller thread/queue, all the rest has absolutely no priority.

Use macros to also defer work done when generate the name of the events.

Reviewed By: nicklockwood

Differential Revision: D2603120

fb-gh-sync-id: e3e36160c893e7ae9ed3558f07c854ea76396661
2015-11-04 09:03:01 -08:00
Nick Lockwood c5b990f65f Added lightweight generic annotations
Summary: public

Added lightweight genarics annotations to make the code more readable and help the compiler catch bugs.

Fixed some type bugs and improved bridge validation in a few places.

Reviewed By: javache

Differential Revision: D2600189

fb-gh-sync-id: f81e22f2cdc107bf8d0b15deec6d5b83aacc5b56
2015-11-03 14:49:30 -08:00
Tadeu Zagallo 6532290397 Guard against dev menu calling twice
Summary: public

The Dev Menu is for some reason eventually calling twice the callbacks, guard
against it while we don't fix it.

Reviewed By: nicklockwood

Differential Revision: D2600470

fb-gh-sync-id: 50c622d2ab64ce50d51572dbfcc076c2765ce582
2015-11-03 07:24:28 -08:00
Tadeu Zagallo 63015b911c Explicitly cast the trampoline prototype to IMP
Summary: public

Add explicitly cast to the trampoline prototype to silence warnings.

Reviewed By: javache

Differential Revision: D2605779

fb-gh-sync-id: e208b69236c1b87bb1374ee493840ea5f47b371c
2015-11-02 10:51:48 -08:00
Tadeu Zagallo ccd90e25c1 Convert remaining uses of alloc] init] to new]
Summary: public

We moved to using `new` instead of `alloc] init` but there was still some calls
left.

Reviewed By: javache

Differential Revision: D2604679

fb-gh-sync-id: ff7300ecbedb55dd5e93873592598810c9b87808
2015-11-02 08:03:17 -08:00
Tadeu Zagallo 010380cca6 Fix CPU profiler upload
Summary: public

Changes were made on the packager that broke the CPU profile upload route,
fix it.

Reviewed By: martinbigio

Differential Revision: D2585184

fb-gh-sync-id: 206744f92d403d6851a69891dfac0c4c11bf1b7e
2015-10-30 14:46:00 -07:00
Tadeu Zagallo 0f92639a96 Prevent RCTProfileTrampoline from getting stripped
Summary: public

I was using `dlsym` as a more elegant way of checking if the function was defined
to prevent crashes if running on an unsupported architecture, but Xcode might
strip the symbol, even with `.no_dead_strip`, if there's no references to the
compilation unit at all.

Replace it with an ugly `#if` that checks if it's any of the supported targets
and extern the function prototype.

Reviewed By: jspahrsummers

Differential Revision: D2581143

fb-gh-sync-id: b004ed351de97f96c04b4a6c914ce55cfcbbbcbb
2015-10-27 13:03:28 -07:00
Tadeu Zagallo 89c1747c33 Implement asm trampoline rather forwardInvocation
Summary: public

The profiler overrides all the methods of all the BridgeModules, and in order to
`start` and `end` the profiler at the function invocation time it used `NSInvocation`,
which is slow.

Replace it with a simple assembly method based on `objc_msgSend`.

Reviewed By: jspahrsummers

Differential Revision: D2550807

fb-gh-sync-id: 88ca08f9d6bfcd3035bda9304c93566c8818b46f
2015-10-20 04:14:09 -07:00