Commit Graph

528 Commits

Author SHA1 Message Date
Alexander Blom ea882b6f16 Immediate dispatch 0 time timers
Summary: Calling setTimeout(f, 0) will currently schedule f to be called the next frame instead of immediately (which is how it behaves on iOS). This immediately calls back to JS and invokes the function.

Reviewed By: astreet, tadeuzagallo

Differential Revision: D3006125

fb-gh-sync-id: 9fa109ed82836a718cbb2e8cb21da4943d96f5f6
shipit-source-id: 9fa109ed82836a718cbb2e8cb21da4943d96f5f6
2016-03-04 09:31:23 -08:00
Andy Street 9199c721de WebWorker: Allow worker script to be loaded from the network in debug builds
Summary:Making buck rebundle the worker script on every JS change is insanely slow. This allows the script to be downloaded for debug builds.

The plan is to couple this with an implementation of `require.resolve` which will automatically insert the correct packager network path in DEV builds and the correct local path in release builds.

e.g.

  var worker = new Worker(require.resolve('WebWorkerSample_getPrimesBetween.js'));

Reviewed By: lexs

Differential Revision: D2939279

fb-gh-sync-id: fbf64bbf1df1649b44e4b98ac504d095c10104a6
shipit-source-id: fbf64bbf1df1649b44e4b98ac504d095c10104a6
2016-03-04 07:34:26 -08:00
Andy Street e64987d780 Fix deadlock in bridge
Summary:There was a deadlock in the bridge if a native module tried to dispatch an event through EventDispatcher (that thread would hold the mTeardownLock and want the mEventStaging lock) at the same time the EventDispatcher callback was triggered and tried to dispatch a call through JS (that thread would hold the mEventStaging lock and want the mTeardownLock).

Now there are two locks (lol). In the scenario above, the native module would hold the mJSToJavaTeardownLock and want the mEventStaging lock, while the EventDispatcher callback would hold the mEventStaging lock and want the mJavaToJSTeardownLock.

Reviewed By: lexs

Differential Revision: D3011526

fb-gh-sync-id: c3ebd5c14a6370d73caebf6c99fcba18a86c6ac1
shipit-source-id: c3ebd5c14a6370d73caebf6c99fcba18a86c6ac1
2016-03-04 05:55:27 -08:00
Andy Street 1b4c23e001 WebWorkers: Update WebWorker sample to use networking/timers
Summary: Updates the sample to use native modules.

Differential Revision: D2932319

fb-gh-sync-id: 9dc12789839ec2d65e98205508d958d0c8c5b46e
shipit-source-id: 9dc12789839ec2d65e98205508d958d0c8c5b46e
2016-03-03 13:34:30 -08:00
Felix Oghina 2e4bb5364d destroy react instance on background critical memory pressure
Reviewed By: astreet

Differential Revision: D2989125

fb-gh-sync-id: 0e441409d6b0ea7d5ff6a037730cc1c36818a2da
shipit-source-id: 0e441409d6b0ea7d5ff6a037730cc1c36818a2da
2016-03-03 11:13:39 -08:00
Felix Oghina 4b52d185ac support simulating critical memory pressure, even when activity is destroyed
Reviewed By: lexs

Differential Revision: D2989094

fb-gh-sync-id: 17bbcac390ab1a3a745f1e85f7cb23d1dcf7043b
shipit-source-id: 17bbcac390ab1a3a745f1e85f7cb23d1dcf7043b
2016-03-03 11:13:34 -08:00
Felix Oghina c027f05ef4 add generic memory pressure listener interface
Reviewed By: lexs

Differential Revision: D2989071

fb-gh-sync-id: 375c7551bd4b281096850732432f016c2684add0
shipit-source-id: 375c7551bd4b281096850732432f016c2684add0
2016-03-03 11:13:28 -08:00
Andy Street 9a3f11d3e7 WebWorkers: Convert NetworkingModule to support web workers
Summary: Converts NetworkingModule to dispatch callbacks to the appropriate ExecutionContext.

Reviewed By: lexs

Differential Revision: D2932170

fb-gh-sync-id: ac77eec1a176ede4d2257bfd8ddb13153331c8a4
shipit-source-id: ac77eec1a176ede4d2257bfd8ddb13153331c8a4
2016-03-03 11:07:32 -08:00
Andy Street e4766b7979 WebWorkers: Update Timing module to support web workers
Summary: Example of a conversion to web worker support using the ExecutionContext API changes made in the last set of web worker diffs. WebWorkerSample now creates timers to show that we can dispatch timer calls to multiple JS contexts.

Reviewed By: lexs

Differential Revision: D2928657

fb-gh-sync-id: 17c5f8cd7c63624da43383da7c4160dc48482fe5
shipit-source-id: 17c5f8cd7c63624da43383da7c4160dc48482fe5
2016-03-03 08:51:33 -08:00
Andy Street 7fb33032f6 Copy weak reference to callback object when dispatching calls to Java
Summary: The bridge could be destructed, meaning we can't try to resolve member variables of PlatformBridgeCallback.

Reviewed By: lexs

Differential Revision: D3005994

fb-gh-sync-id: f83de432148ce62fd1060c6b84ec39ad2fa10a55
shipit-source-id: f83de432148ce62fd1060c6b84ec39ad2fa10a55
2016-03-03 07:52:30 -08:00
Konstantin Raev 32dd1fe35a fixed instrumentation tests crashes in emulator
Summary:Improving CircleCI stability running tests
Closes https://github.com/facebook/react-native/pull/6270

Differential Revision: D3005903

fb-gh-sync-id: 3421546a19b20db5485b3f816e2c6008e8121749
shipit-source-id: 3421546a19b20db5485b3f816e2c6008e8121749
2016-03-03 07:30:35 -08:00
Andy Street 6d5f9ddfff WebWorkers: Allow native modules to be notified when executors are unregistered
Summary: This will allow them to clean up resources when a web worker goes away.

Reviewed By: mhorowitz, lexs

Differential Revision: D2994721

fb-gh-sync-id: c7ca1afc7290e85038cf692a139f6478dba0ef61
shipit-source-id: c7ca1afc7290e85038cf692a139f6478dba0ef61
2016-03-03 04:10:39 -08:00
Sokovikov 1bab7c5182 vibration module
Summary:I will fix other notes from https://github.com/facebook/react-native/pull/2794 if I get positive feedback.
Closes https://github.com/facebook/react-native/pull/6061

Reviewed By: nicklockwood

Differential Revision: D2982173

Pulled By: dmmiller

fb-gh-sync-id: d1e9407798b0293b090897a10996085b0f0c1b3e
shipit-source-id: d1e9407798b0293b090897a10996085b0f0c1b3e
2016-03-03 04:08:31 -08:00
Dan Caspi d2d00e0fcd Adding GC Timer Sweeping to Android
Reviewed By: mhahnenberg

Differential Revision: D2972822

fb-gh-sync-id: b0ed28c26e3f1141c798d9d107d9e198611f9dce
shipit-source-id: b0ed28c26e3f1141c798d9d107d9e198611f9dce
2016-03-03 04:05:59 -08:00
Michał Gregorczyk 5a6a94b05a sync fbjni
Differential Revision: D2990551

fb-gh-sync-id: 587f2b5cd09295dc1829926c12e38f2880440a5e
shipit-source-id: 587f2b5cd09295dc1829926c12e38f2880440a5e
2016-03-02 07:24:40 -08:00
Michał Gregorczyk 5df3eeb723 Force 16 byte stack alignment on JNI method invocations on x86
Reviewed By: dcolascione

Differential Revision: D2989293

fb-gh-sync-id: 9140ced55ef0b8a73fdc03a6d307af87cd2335ef
shipit-source-id: 9140ced55ef0b8a73fdc03a6d307af87cd2335ef
2016-03-02 07:24:35 -08:00
AbilashK ab12189f87 Enable blurOnSubmit for text input in android
Summary:PR for https://github.com/facebook/react-native/issues/6098, Added tests to UIExplorer based on existing iOS example.

Before:
![blur_true](https://cloud.githubusercontent.com/assets/11550281/13401854/cd66117a-df33-11e5-875d-e1f132e2fc82.gif)

After:
![blur_false](https://cloud.githubusercontent.com/assets/11550281/13401874/de1dd1ce-df33-11e5-8210-e6bee80240fb.gif)
Closes https://github.com/facebook/react-native/pull/6215

Differential Revision: D3000042

Pulled By: mkonicek

fb-gh-sync-id: 7f01270580b198498505d92e38a456c0b3a01488
shipit-source-id: 7f01270580b198498505d92e38a456c0b3a01488
2016-03-02 07:07:32 -08:00
Konstantin Raev f827f7b79a instrumentation tests are executed with BUCK
Summary:Added ability to run instrumentation tests with BUCK.

This change uses BUCK to build and run instrumentation tests facebook style.
The gains are that we can execute the same tests internally at FB and in OSS.
Also running tests not via graddle:connect command is 1.5 minutes faster.

I'll keep keep an eye on stability Gradle and BUCK builds for a while.
Closes https://github.com/facebook/react-native/pull/6176

Differential Revision: D2999878

Pulled By: bestander

fb-gh-sync-id: d715ba231769e57100685a1256f2e530c589921c
shipit-source-id: d715ba231769e57100685a1256f2e530c589921c
2016-03-02 06:55:35 -08:00
Konstantin Raev 00178b7b36 Added prebuilt folder with BUCK files to support BUCK run of ReactAndroid in OSS
This is a manualt sync of a folder from fbsource that was previously in ignored list
2016-03-02 11:09:31 +00:00
Andy Street bd95b22844 WebWorkers: Add ExecutorToken to route native module calls to/from workers
Summary:To support native modules in web workers, native modules need to have an notion of the JS executor/thread that called into them in order to respond via Callback or JS module call to the right executor on the right thread.

ExecutorToken is an object that only serves as a token that can be used to identify an executor/message queue thread in the bridge. It doesn't expose any methods. Native modules Callback objects automatically have this ExecutionContext attached -- JSModule calls for modules that support workers will need to supply an appropriate ExecutorToken when retrieving the JSModule implementation from the ReactContext.

Reviewed By: mhorowitz

Differential Revision: D2965458

fb-gh-sync-id: 6e354d4df8536d40b12d02bd055f6d06b4ca595d
shipit-source-id: 6e354d4df8536d40b12d02bd055f6d06b4ca595d
2016-03-01 07:57:35 -08:00
Andy Street 58f86b2d91 Don't execute things that may throw in Bridge/JSCExecutor dtors
Summary:In testing, I've found that there's no good way to return stack traces to the server for exceptions that happen in dtor's. If the dtor is not marked nothrow(false), the exceptions are uncatchable (and bubble up as a std::abort without exception info) and if annotated properly, the program instead crashes trying to resume the stack, again a std::abort without exception info.

Instead, I created a separate destroy method that can be called (and protected via fbjni) to make the dtor's no longer execute code that may throw. Note that we don't really expect the code that was previously in ~JSCExecutor() to throw, but it was in production and we had absolutely no info to help debug it.

Reviewed By: mhorowitz

Differential Revision: D2989999

fb-gh-sync-id: 4cf9de5e0592fe6830a9903375363a78e1339a94
shipit-source-id: 4cf9de5e0592fe6830a9903375363a78e1339a94
2016-03-01 04:26:35 -08:00
Ahmed El-Helw 9be1216c7f Minor code improvements for RCTTextInput
Summary: Expose hasUnseenUpdates in ReactShadowNode. Various text input cleanup and fixes.

Differential Revision: D2975870

fb-gh-sync-id: 26c4c0d36e82aaa025b4760603cc48c47ebf46a3
shipit-source-id: 26c4c0d36e82aaa025b4760603cc48c47ebf46a3
2016-02-29 16:43:32 -08:00
Chris Hopman e55cefc476 Add log message to bridge init
Reviewed By: mhorowitz

Differential Revision: D2983352

fb-gh-sync-id: d87fcb7d7728115ae45cdb6f061fa094da7dfba8
shipit-source-id: d87fcb7d7728115ae45cdb6f061fa094da7dfba8
2016-02-29 12:49:01 -08:00
Andy Street f99579adaa Try/catch exceptions in JSCExecutor for debugging crash
Reviewed By: lexs

Differential Revision: D2982534

fb-gh-sync-id: 4eda4116cd60e2e46771ecddefc1d27eee761762
shipit-source-id: 4eda4116cd60e2e46771ecddefc1d27eee761762
2016-02-26 10:58:29 -08:00
Andy Street f420f811c5 Revert D2982150: Revert D2926896 WebWorkers: Move web worker impl to JSCExecutor
Reviewed By: lexs

Differential Revision: D2982364

fb-gh-sync-id: 25f099377acca75298768072d38d77dcb9c1bff3
shipit-source-id: 25f099377acca75298768072d38d77dcb9c1bff3
2016-02-26 08:43:36 -08:00
Dave Miller 9edfd945d1 Fix minor code nit from D2977441
Reviewed By: andreicoman11

Differential Revision: D2982182

fb-gh-sync-id: dba3c6ea0dfbd375e3c27d3ad2ba3481d05e06e8
shipit-source-id: dba3c6ea0dfbd375e3c27d3ad2ba3481d05e06e8
2016-02-26 06:46:35 -08:00
Felix Oghina 9baef48498 decouple textview from fresco
Reviewed By: andreicoman11

Differential Revision: D2960626

fb-gh-sync-id: c03aa7f16cdea795cefe39da2c5d660ae6278a37
shipit-source-id: c03aa7f16cdea795cefe39da2c5d660ae6278a37
2016-02-26 06:16:49 -08:00
Andy Street c32e5fd84f Revert D2926896 WebWorkers: Move web worker impl to JSCExecutor
Reviewed By: lexs

Differential Revision: D2982150

fb-gh-sync-id: c75d05988df50b9788608e7c1bf00c4952ccfce1
shipit-source-id: c75d05988df50b9788608e7c1bf00c4952ccfce1
2016-02-26 05:56:36 -08:00
Andrei Coman d032cc967d Pass jsc config to JSC
Reviewed By: astreet

Differential Revision: D2965497

fb-gh-sync-id: 1aef5a1f2d7ccb8de8ca403e51ebcf247bd6b034
shipit-source-id: 1aef5a1f2d7ccb8de8ca403e51ebcf247bd6b034
2016-02-26 03:24:36 -08:00
Dave Miller 542432fc3e Launch a new task if openURL is called with a url in a different package
Summary: Change the default handling of openURL to attach the NEW_TASK flag if the package we will be launching is different than the currently running package.

Reviewed By: foghina

Differential Revision: D2977441

fb-gh-sync-id: 01d1ac1d791345f815bfc9e8358bce6420c08c1b
shipit-source-id: 01d1ac1d791345f815bfc9e8358bce6420c08c1b
2016-02-26 03:12:32 -08:00
Matthew Denner b860897cd5 Restore canvas once group has been drawn
Summary:The implementation of ARTGroupShadowNode saved the canvas and then drew the child nodes but did not reset the canvas afterwards, unlike the behaviour of the other ART shadow nodes.  Because of this the matrix operations were compounded for sibling nodes in the surface.

As an example the following code should draw a green circle in the bottom right corner of the surface and a red circle in the top left, which it does on iOS; on Android you'll find that the red circle is drawn in the bottom right corner instead.

```
'use strict';
import React, {
  AppRegistry,
  Component,
  StyleSheet,
  View,
} from 'react-native';

const { Surface, Group, Shape } = React.ART;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#808080',
  },
  surface: {
    backgroundColor: '#ffffff'
  },
});

class ARTGroupBug extends Component {
  render() {
    return (
      <View style={styles.container}>
        <
Closes https://github.com/facebook/react-native/pull/5619

Differential Revision: D2981865

Pulled By: spicyj

fb-gh-sync-id: 95ca701354fe728ed6ee78f8c02d1e1eb70c181e
shipit-source-id: 95ca701354fe728ed6ee78f8c02d1e1eb70c181e
2016-02-26 00:42:33 -08:00
AbilashK 8b88cae747 Fix android's image tintColor prop when used with alpha
Summary:Fixes https://github.com/facebook/react-native/issues/6075
UIExplorer example has been tested with 4 levels of opacity(100,75,50,25)

![selection_029](https://cloud.githubusercontent.com/assets/11550281/13228124/31c85dcc-d9c0-11e5-90e3-3938e155d5a2.png)
Closes https://github.com/facebook/react-native/pull/6090

Differential Revision: D2979913

Pulled By: mkonicek

fb-gh-sync-id: ff30dec853935a059979096d9b1da9088d146249
shipit-source-id: ff30dec853935a059979096d9b1da9088d146249
2016-02-25 17:16:02 -08:00
Konstantin Raev 5112a63953 Added ability to run Movies app with BUCK
Reviewed By: mkonicek

Differential Revision: D2874873

fb-gh-sync-id: 9feface8d9a18742e68206dbafb804de25f53ed8
shipit-source-id: 9feface8d9a18742e68206dbafb804de25f53ed8
2016-02-25 17:15:58 -08:00
Martin Konicek 9d3d9dfbce Make fbsource and GitHub consistent 2016-02-25 17:13:25 -08:00
Ahmed El-Helw 652c1c11e4 Fix incorrect MeasureSpec in ReactTextInputShadowNode
Summary:WRAP_CONTENT is not a valid size for MeasureSpec. While 0 is
a valid value size to pass to makeMeasureSpec, it's slightly cheaper to just
pass in 0 instead since makeMeasureSpec(0, UNSPECIFIED) is 0 anyway.

Differential Revision: D2968322

fb-gh-sync-id: 2ca0e27b12c1a8263800d96fec32127a4b967497
shipit-source-id: 2ca0e27b12c1a8263800d96fec32127a4b967497
2016-02-25 16:27:32 -08:00
Alexander Blom b8e7fe4959 Copy exif data when resizing images in ImageEditingManager
Summary:Previously images that have exif orientation data would be cropped and the exif data
would be lost leading to us displaying pictures rotated in error.

Reviewed By: foghina

Differential Revision: D2971596

fb-gh-sync-id: 40f92e27089455259a7d8b83c92d0cf36367e5df
shipit-source-id: 40f92e27089455259a7d8b83c92d0cf36367e5df
2016-02-25 07:46:39 -08:00
Ahmed El-Helw 6b80f11652 Add switch for enabling nodes screenshot tests
Summary: Allow customizing the UIImplementation passed in to loadApp.

Differential Revision: D2975785

fb-gh-sync-id: 2ce081fb488b78c0c91fcebe6a37dac4f587a467
shipit-source-id: 2ce081fb488b78c0c91fcebe6a37dac4f587a467
2016-02-24 21:13:35 -08:00
Michał Gregorczyk 9836b297ad Align stack on all JSC API calls
Reviewed By: astreet

Differential Revision: D2971504

fb-gh-sync-id: 4f2cb5924c135aa39853e6746b0a35e30f3e93a4
shipit-source-id: 4f2cb5924c135aa39853e6746b0a35e30f3e93a4
2016-02-24 13:00:41 -08:00
Andrei Coman 36400807ab Remove unused variable
Reviewed By: bestander

Differential Revision: D2971225

fb-gh-sync-id: 827d4403d436ec74043e2dde02e19513f7bf811f
shipit-source-id: 827d4403d436ec74043e2dde02e19513f7bf811f
2016-02-24 10:49:33 -08:00
Jason Sendros f538032888 Sync CSSLayout: Make 'stretch' aligned children fill cross-axis in containers of undefined size in the cross-axis
Reviewed By: lucasr

Differential Revision: D2971032

fb-gh-sync-id: 90ec286ca2070d666571fd3d0db4037bc9d3cda7
shipit-source-id: 90ec286ca2070d666571fd3d0db4037bc9d3cda7
2016-02-24 08:57:37 -08:00
Andrei Coman 936b5e794b Backed out changeset fe59b7f7c7da
Reviewed By: javache

Differential Revision: D2971309

fb-gh-sync-id: 0104f5499d32e0a4e4bd24128c58a9ee4aa7ca4e
shipit-source-id: 0104f5499d32e0a4e4bd24128c58a9ee4aa7ca4e
2016-02-24 08:39:35 -08:00
Andreas Drivenes ec173b1a17 Add drawerLockMode prop to DrawerLayoutAndroid
Summary:Closes #5270.
Closes https://github.com/facebook/react-native/pull/5534

Differential Revision: D2970771

fb-gh-sync-id: 36a814032283df7d4c469964f803b8d20d1b0c93
shipit-source-id: 36a814032283df7d4c469964f803b8d20d1b0c93
2016-02-24 03:25:30 -08:00
Chris Hopman 11843fd10e Initialize glog in react native.
Reviewed By: mhorowitz

Differential Revision: D2967180

fb-gh-sync-id: fe59b7f7c7dab8b5e7f3a449e72b467e1c2c2c67
shipit-source-id: fe59b7f7c7dab8b5e7f3a449e72b467e1c2c2c67
2016-02-24 02:18:28 -08:00
Konstantin Raev a759131ca1 another patch hoping to fix chronos 2016-02-24 10:17:56 +00:00
Konstantin Raev 96ecfade11 manual file sync for oss sync bot 2016-02-24 10:13:35 +00:00
Konstantin Raev ecfd4f854b patch commit that was not synced from fbsource
This one was not synced correctly https://phabricator.fb.com/rFAaebd840baa045b25f7c6641a0657b3cb1a01ba78
2016-02-24 10:01:37 +00:00
Andy Street 7176c5291e Dispatch JS calls to JS thread from c++ bridge
Summary: Instead of dispatching calls to the JS thread in Java, do it in the C++ bridge. This moves us closer to the cxx bridge and will allow us to dispatch to the correct web worker in C++ instead of in Java

Reviewed By: mhorowitz

Differential Revision: D2954115

fb-gh-sync-id: 7e7d4eff2c72601b8b4416f1ccd8d2985aebd755
shipit-source-id: 7e7d4eff2c72601b8b4416f1ccd8d2985aebd755
2016-02-23 10:59:00 -08:00
Mark Hahnenberg c17428e9d2 Schedule memory pressure handlers onto JS queue thread
Reviewed By: lexs

Differential Revision: D2940927

fb-gh-sync-id: 2556925194a753a33f039dc841a4001d7ede2bce
shipit-source-id: 2556925194a753a33f039dc841a4001d7ede2bce
2016-02-22 07:46:28 -08:00
Andy Street 5534f8b7c7 Fix instacrash on login in rnfeed
Summary:build-break

Proguard was renaming MessageQueueThread interface methods that we reference from c++.

Differential Revision: D2960332

fb-gh-sync-id: 572dcd8a64e774f65c5abfb8cdf891efcb2bd591
shipit-source-id: 572dcd8a64e774f65c5abfb8cdf891efcb2bd591
2016-02-22 06:03:33 -08:00
Konstantin Raev 26a7335d4d Backed out changeset 837af947846b
Reviewed By: astreet

Differential Revision: D2960159

fb-gh-sync-id: ec8df9c2f7213879470482b77346b3872c26413d
shipit-source-id: ec8df9c2f7213879470482b77346b3872c26413d
2016-02-22 03:58:30 -08:00