commit | 7e502f7804db0e54a6fc10d8598bb641a4ddf831 | [log] [tgz] |
---|---|---|
author | Kurt Horimoto <kkhorimoto@chromium.org> | Thu Jan 10 02:12:02 2019 |
committer | Commit Bot <commit-bot@chromium.org> | Thu Jan 10 02:12:02 2019 |
tree | fddea8403fa79e932d9d46c148dd5f60d5d9d7a2 | |
parent | 32d39951e6427705484b3d023fb48b59c9223432 [diff] |
[iOS] Create safe WebKit completion block utility functions. Completion blocks provided by WebKit to the WKUIDelegate contain a helper object that will throw an exception if the block is deallocated before being executed. This CL adds helper functions that add a similar mechanism that ensures that these blocks are executed before deallocation. Internally, these functions use wrapper objects that call the WebKit blocks upon deallocation. These wrapper objects are not exposed externally in an attempt to ensure that their lifetime is tightly coupled with the lifetime of the block. Exposing the wrappers publicly allows for the possibility of mistakenly extending the lifetime of the WebKit blocks due to being erroneously retained. Once the C++14 move semantics for lambda introducers are allowed by the style guide, we can instead construct these call checker objects using C++ objects whose destruction can be guaranteed to occur at a certain time. Bug: 915119 Change-Id: Ifeac4359f5436ede281def418eb81b1620ba2198 Reviewed-on: https://chromium-review.googlesource.com/c/1392356 Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org> Reviewed-by: Eugene But <eugenebut@chromium.org> Cr-Commit-Position: refs/heads/master@{#621424}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .