{"push_id":1002316889,"size":1,"distinct_size":1,"ref":"refs/heads/lifecycletracker-no-deprecated-api","head":"92bdf3c56e23e7804e948d9b8a7c63c0532d9621","before":"3e262be966d71a490513d3026c1f5ab6310c2faa","commits":[{"sha":"92bdf3c56e23e7804e948d9b8a7c63c0532d9621","author":{"email":"5fe4d20cf6ab8a2cf4e5e71d4c2d58346e96df0d@intel.com","name":"Raphael Kubo da Costa"},"message":"v8tools: Port the lifecycleTracker code to non-deprecated API.\n\nV8 is deprecating its previous `v8::PersistentBase::SetWeak()` calls\nthat turned a persistent object into a weak reference. The new SetWeak()\nAPI turns the handle into a phantom reference, a concept borrowed from\nJava that means a callback set when calling SetWeak() will be run\n_after_ the object being referenced has already been garbage-collected.\nThis is happening most likely due to performance reasons, as memory can\nbe reclaimed in one GC cycle instead of two. Relevant CLs and bugs:\n - https://bugs.chromium.org/p/v8/issues/detail?id=3246\n - https://codereview.chromium.org/687003005\n - https://codereview.chromium.org/753553002\n - https://codereview.chromium.org/989153003\n\nFor us, this means the lifecycleTracker code needs to be rewritten, as\nwe were relying on the referenced lifecycleTracker object still being\nalive when running the cleanup callback in order to retrieve the\nfunction associated with the object's `destructor` property.\n\nWhat we do now is track the function assigned to the `destructor`\nproperty separately at the time of the assignment and invoke it without\ngoing through the referenced object during the cleanup.\n\nThe code gets more verbose, but I believe it makes things more clear:\n- There's now a getter for the `destructor` property, which returns the\n  function assigned, or null when there is none. Previously, if no\n  destructor had been set accessing the property would return undefined.\n- Related to this, the `destructor` property is no longer deletable.\n  Users need to set it to null in order to remove a previously\n  associated function. Combined with the above point, this makes it more\n  explicit that `destructor` is not a regular property and is always\n  present (and enumerable) in the object.\n- The property's setter performs type checking on the value being\n  assigned, raises a `TypeError` when an invalid type is passed and\n  clears up the function if null is passed. Previously one could pass\n  any type and the checking would only be done when the cleanup function\n  was being run and there would be no JS error if an invalid type had\n  been passed (only a debug warning in C++).\n\nBUG=XWALK-6372","distinct":true,"url":"https://api.github.com/repos/rakuco/crosswalk/commits/92bdf3c56e23e7804e948d9b8a7c63c0532d9621"}]}