<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[211706] branches/safari-603-branch/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/211706">211706</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2017-02-05 22:17:20 -0800 (Sun, 05 Feb 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/211551">r211551</a>. rdar://problem/26685576</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari603branchSourceWebCoreChangeLog">branches/safari-603-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebCoreWebCorexcodeprojprojectpbxproj">branches/safari-603-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari603branchSourceWebKitChangeLog">branches/safari-603-branch/Source/WebKit/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebKitWebKitxcodeprojprojectpbxproj">branches/safari-603-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari603branchSourceWebKitiosChangeLog">branches/safari-603-branch/Source/WebKit/ios/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebKitiosMiscWebUIKitSupporth">branches/safari-603-branch/Source/WebKit/ios/Misc/WebUIKitSupport.h</a></li>
<li><a href="#branchessafari603branchSourceWebKitiosMiscWebUIKitSupportmm">branches/safari-603-branch/Source/WebKit/ios/Misc/WebUIKitSupport.mm</a></li>
<li><a href="#branchessafari603branchSourceWebKitmacChangeLog">branches/safari-603-branch/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebKitmacStorageWebDatabaseManagermm">branches/safari-603-branch/Source/WebKit/mac/Storage/WebDatabaseManager.mm</a></li>
<li><a href="#branchessafari603branchSourceWebKitmacStorageWebDatabaseManagerInternalh">branches/safari-603-branch/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h</a></li>
<li><a href="#branchessafari603branchSourceWebKitmacWebCoreSupportWebApplicationCachemm">branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm</a></li>
<li><a href="#branchessafari603branchSourceWebKitmacWebViewWebViewmm">branches/safari-603-branch/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#branchessafari603branchSourceWebKit2ChangeLog">branches/safari-603-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceWebKit2UIProcessAPICocoaWKWebViewmm">branches/safari-603-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari603branchSourceWebCoreplatformiosWebBackgroundTaskControllerh">branches/safari-603-branch/Source/WebCore/platform/ios/WebBackgroundTaskController.h</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformiosWebBackgroundTaskControllermm">branches/safari-603-branch/Source/WebCore/platform/ios/WebBackgroundTaskController.mm</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformiosWebSQLiteDatabaseTrackerClienth">branches/safari-603-branch/Source/WebCore/platform/ios/WebSQLiteDatabaseTrackerClient.h</a></li>
<li><a href="#branchessafari603branchSourceWebCoreplatformiosWebSQLiteDatabaseTrackerClientmm">branches/safari-603-branch/Source/WebCore/platform/ios/WebSQLiteDatabaseTrackerClient.mm</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#branchessafari603branchSourceWebKitiosStorageWebSQLiteDatabaseTrackerClienth">branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h</a></li>
<li><a href="#branchessafari603branchSourceWebKitiosStorageWebSQLiteDatabaseTrackerClientmm">branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari603branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/ChangeLog        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -1,5 +1,51 @@
</span><span class="cx"> 2017-02-05 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r211551. rdar://problem/26685576
+
+ 2017-02-02 Yongjun Zhang <yongjun_zhang@apple.com>
+
+ In iOS, we should take background assertion when accessing localstorage databases.
+ https://bugs.webkit.org/show_bug.cgi?id=165478
+
+ Move WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore so that it can be accessible from
+ WebKit1 and WebKit2. Previously, to avoid dependencies on UIKit, WebKitLegacy introduced several
+ global methods for UIKit to setup the start/end background task blocks on runtime (WebKitSetStartBackgroundTaskBlock,
+ WebKitSetInvalidWebBackgroundTaskIdentifier and WebKitSetEndBackgroundTaskBlock). Since we have to
+ move the background task handling to WebCore, to avoid adding WebCore dependencies on UIKit, this
+ patch introdues a new WebCore class WebBackgroundTaskController which holds the start/end background
+ task blocks. The existing WebKitSetStartBackgroundTaskBlock and WebKitSetEndBackgroundTaskBlock methods
+ in WebKit1 will use WebBackgroundTaskController to store the blocks set by UIKit.
+
+ Reviewed by Brady Eidson.
+
+ No new test since this is code refactoring.
+
+ * WebCore.xcodeproj/project.pbxproj: Add a new class WebBackgroundTaskController to the project. Also move
+ WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore.
+ * platform/ios/WebBackgroundTaskController.h: Use properties to hold the blocks for starting or ending background tasks.
+ * platform/ios/WebBackgroundTaskController.mm:
+ (+[WebBackgroundTaskController sharedController]):
+ (-[WebBackgroundTaskController dealloc]):
+ (-[WebBackgroundTaskController startBackgroundTaskWithExpirationHandler:]): Start a background task with a expiration handler;
+ to start the background task, we will use backgroundTaskStartBlock set up by UIKit.
+ (-[WebBackgroundTaskController endBackgroundTaskWithIdentifier:]): Call backgroundTaskEndBlack to end a background task.
+ * platform/ios/WebSQLiteDatabaseTrackerClient.h: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h.
+ * platform/ios/WebSQLiteDatabaseTrackerClient.mm: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm.
+ (WebCore::WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient): Make WebSQLiteDatabaseTrackerClient a singleton.
+ (WebCore::WebSQLiteDatabaseTrackerClient::WebSQLiteDatabaseTrackerClient):
+ (WebCore::WebSQLiteDatabaseTrackerClient::~WebSQLiteDatabaseTrackerClient):
+ (WebCore::WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction): Use a utility class WebDatabaseTransactionBackgroundTaskController
+ to schedule database transaction background task.
+ (WebCore::WebSQLiteDatabaseTrackerClient::didFinishLastTransaction): Use WebDatabaseTransactionBackgroundTaskController to stop
+ databas transaction background task.
+ (transactionBackgroundTaskIdentifierLock: Moved from Source/WebKit/mac/Storage/WebDatabaseManager.mm.
+ (setTransactionBackgroundTaskIdentifier): Ditto.
+ (getTransactionBackgroundTaskIdentifier): Ditto.
+ (+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]): Ditto.
+ (+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]): Ditto.
+
+2017-02-05 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r211446. rdar://problem/30273885
</span><span class="cx">
</span><span class="cx"> 2017-01-31 Anders Carlsson <andersca@apple.com>
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -1009,10 +1009,14 @@
</span><span class="cx">                 1CCDF5BD1990332400BCEBAD /* SVGToOTFFontConversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CCDF5BB1990332400BCEBAD /* SVGToOTFFontConversion.cpp */; };
</span><span class="cx">                 1CCDF5BE1990332400BCEBAD /* SVGToOTFFontConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CCDF5BC1990332400BCEBAD /* SVGToOTFFontConversion.h */; };
</span><span class="cx">                 1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */; };
</span><ins>+                1F36EA9C1E21BA1700621E25 /* WebBackgroundTaskController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F36EA9A1E21BA1700621E25 /* WebBackgroundTaskController.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                1F36EA9D1E21BA1700621E25 /* WebBackgroundTaskController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F36EA9B1E21BA1700621E25 /* WebBackgroundTaskController.mm */; };
</ins><span class="cx">                 1F3C3BEA135CAF3C00B8C1AC /* MediaControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1F3C3BE8135CAF3C00B8C1AC /* MediaControls.cpp */; };
</span><span class="cx">                 1F3C3BEB135CAF3C00B8C1AC /* MediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F3C3BE9135CAF3C00B8C1AC /* MediaControls.h */; };
</span><ins>+                1F4B419B1E2301C900AC037F /* WebSQLiteDatabaseTrackerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F8756B01E22BEEF0042C40D /* WebSQLiteDatabaseTrackerClient.mm */; };
</ins><span class="cx">                 1F72BF0A187FD4490009BCB3 /* TileControllerMemoryHandlerIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1F72BF08187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.cpp */; };
</span><span class="cx">                 1F72BF0B187FD45C0009BCB3 /* TileControllerMemoryHandlerIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F72BF09187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                1F8756B21E22C3350042C40D /* WebSQLiteDatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F8756B11E22BEEF0042C40D /* WebSQLiteDatabaseTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1FAFBF1715A5FA5200083A20 /* UTIUtilities.mm */; };
</span><span class="cx">                 1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */; };
</span><span class="cx">                 1FC40FB91655CCB60040F29E /* SubimageCacheWithTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1FC40FB81655C5910040F29E /* SubimageCacheWithTimer.cpp */; };
</span><span class="lines">@@ -8113,10 +8117,14 @@
</span><span class="cx">                 1CDD45E50BA9C84600F90147 /* WebCore.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebCore.xcconfig; sourceTree = "<group>"; };
</span><span class="cx">                 1CDD45E60BA9C84600F90147 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
</span><span class="cx">                 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = "<absolute>"; };
</span><ins>+                1F36EA9A1E21BA1700621E25 /* WebBackgroundTaskController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackgroundTaskController.h; sourceTree = "<group>"; };
+                1F36EA9B1E21BA1700621E25 /* WebBackgroundTaskController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebBackgroundTaskController.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 1F3C3BE8135CAF3C00B8C1AC /* MediaControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaControls.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 1F3C3BE9135CAF3C00B8C1AC /* MediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControls.h; sourceTree = "<group>"; };
</span><span class="cx">                 1F72BF08187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TileControllerMemoryHandlerIOS.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 1F72BF09187FD4270009BCB3 /* TileControllerMemoryHandlerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TileControllerMemoryHandlerIOS.h; sourceTree = "<group>"; };
</span><ins>+                1F8756B01E22BEEF0042C40D /* WebSQLiteDatabaseTrackerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSQLiteDatabaseTrackerClient.mm; sourceTree = "<group>"; };
+                1F8756B11E22BEEF0042C40D /* WebSQLiteDatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSQLiteDatabaseTrackerClient.h; sourceTree = "<group>"; };
</ins><span class="cx">                 1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTIUtilities.h; sourceTree = "<group>"; };
</span><span class="cx">                 1FAFBF1715A5FA5200083A20 /* UTIUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UTIUtilities.mm; sourceTree = "<group>"; };
</span><span class="cx">                 1FC40FB71655C5910040F29E /* SubimageCacheWithTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubimageCacheWithTimer.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -19716,6 +19724,8 @@
</span><span class="cx">                                 837B7D1F1DC3F54C00D051FC /* ValidationBubbleIOS.mm */,
</span><span class="cx">                                 CDA29A2C1CBF73FC00901CCF /* WebAVPlayerController.h */,
</span><span class="cx">                                 CDA29A2D1CBF73FC00901CCF /* WebAVPlayerController.mm */,
</span><ins>+                                1F36EA9A1E21BA1700621E25 /* WebBackgroundTaskController.h */,
+                                1F36EA9B1E21BA1700621E25 /* WebBackgroundTaskController.mm */,
</ins><span class="cx">                                 31403797124BEA7F00AF40E4 /* WebCoreMotionManager.h */,
</span><span class="cx">                                 31403798124BEA7F00AF40E4 /* WebCoreMotionManager.mm */,
</span><span class="cx">                                 E45390380EAFD637003695C8 /* WebCoreSystemInterfaceIOS.mm */,
</span><span class="lines">@@ -19723,6 +19733,8 @@
</span><span class="cx">                                 FE0D84EA1048436E001A179E /* WebEvent.mm */,
</span><span class="cx">                                 CDA29A2E1CBF73FC00901CCF /* WebPlaybackSessionInterfaceAVKit.h */,
</span><span class="cx">                                 CDA29A2F1CBF73FC00901CCF /* WebPlaybackSessionInterfaceAVKit.mm */,
</span><ins>+                                1F8756B01E22BEEF0042C40D /* WebSQLiteDatabaseTrackerClient.mm */,
+                                1F8756B11E22BEEF0042C40D /* WebSQLiteDatabaseTrackerClient.h */,
</ins><span class="cx">                                 3F42B31B1881191B00278AAC /* WebVideoFullscreenControllerAVKit.h */,
</span><span class="cx">                                 3F42B31C1881191B00278AAC /* WebVideoFullscreenControllerAVKit.mm */,
</span><span class="cx">                                 3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */,
</span><span class="lines">@@ -25482,6 +25494,7 @@
</span><span class="cx">                                 D0BD4F5D1408850F006839B6 /* DictationCommandIOS.h in Headers */,
</span><span class="cx">                                 937FF3D51A1012D6008EBA31 /* DictionaryLookup.h in Headers */,
</span><span class="cx">                                 2D5646B01B8F8493003C4994 /* DictionaryPopupInfo.h in Headers */,
</span><ins>+                                1F36EA9C1E21BA1700621E25 /* WebBackgroundTaskController.h in Headers */,
</ins><span class="cx">                                 FDAF19991513D131008DB0C3 /* DirectConvolver.h in Headers */,
</span><span class="cx">                                 7EDAAFC919A2CCDC0034DFD1 /* DiskCacheMonitorCocoa.h in Headers */,
</span><span class="cx">                                 0FE5FBD31C3DD51E0007A2CA /* DisplayList.h in Headers */,
</span><span class="lines">@@ -25578,6 +25591,7 @@
</span><span class="cx">                                 4F1534DE11B532EC0021FD86 /* EditingBehavior.h in Headers */,
</span><span class="cx">                                 4F1534E011B533020021FD86 /* EditingBehaviorTypes.h in Headers */,
</span><span class="cx">                                 3AC648B2129E146500C3EB25 /* EditingBoundary.h in Headers */,
</span><ins>+                                1F8756B21E22C3350042C40D /* WebSQLiteDatabaseTrackerClient.h in Headers */,
</ins><span class="cx">                                 9BAB6C6C12550631001626D4 /* EditingStyle.h in Headers */,
</span><span class="cx">                                 4B3043CD0AE0373B00A82647 /* Editor.h in Headers */,
</span><span class="cx">                                 1AF326790D78B9440068F0C4 /* EditorClient.h in Headers */,
</span><span class="lines">@@ -30444,6 +30458,7 @@
</span><span class="cx">                                 B2FA3DD80AB75A6F000E5AC4 /* JSSVGPathSegLinetoVerticalRel.cpp in Sources */,
</span><span class="cx">                                 B2FA3DDA0AB75A6F000E5AC4 /* JSSVGPathSegList.cpp in Sources */,
</span><span class="cx">                                 B2FA3DDC0AB75A6F000E5AC4 /* JSSVGPathSegMovetoAbs.cpp in Sources */,
</span><ins>+                                1F36EA9D1E21BA1700621E25 /* WebBackgroundTaskController.mm in Sources */,
</ins><span class="cx">                                 B2FA3DDE0AB75A6F000E5AC4 /* JSSVGPathSegMovetoRel.cpp in Sources */,
</span><span class="cx">                                 B2FA3DE00AB75A6F000E5AC4 /* JSSVGPatternElement.cpp in Sources */,
</span><span class="cx">                                 8542A7960AE5C94200DF58DF /* JSSVGPoint.cpp in Sources */,
</span><span class="lines">@@ -31958,6 +31973,7 @@
</span><span class="cx">                                 85217E020A5ECD4700DB8D00 /* XSLImportRule.cpp in Sources */,
</span><span class="cx">                                 93F19B0308245E59001E9ABC /* XSLStyleSheetLibxslt.cpp in Sources */,
</span><span class="cx">                                 E1F1E82F0C3C2BB9006DB391 /* XSLTExtensions.cpp in Sources */,
</span><ins>+                                1F4B419B1E2301C900AC037F /* WebSQLiteDatabaseTrackerClient.mm in Sources */,
</ins><span class="cx">                                 93F19B0408245E59001E9ABC /* XSLTProcessor.cpp in Sources */,
</span><span class="cx">                                 93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */,
</span><span class="cx">                                 E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
</span></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformiosWebBackgroundTaskControllerhfromrev211705branchessafari603branchSourceWebKitiosStorageWebSQLiteDatabaseTrackerClientmm"></a>
<div class="copfile"><h4>Copied: branches/safari-603-branch/Source/WebCore/platform/ios/WebBackgroundTaskController.h (from rev 211705, branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm) (0 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/ios/WebBackgroundTaskController.h         (rev 0)
+++ branches/safari-603-branch/Source/WebCore/platform/ios/WebBackgroundTaskController.h        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2010, 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if PLATFORM(IOS)
+
+WEBCORE_EXPORT @interface WebBackgroundTaskController : NSObject
+
+@property (nonatomic) NSUInteger invalidBackgroundTaskIdentifier;
+@property (nonatomic, copy) NSUInteger (^backgroundTaskStartBlock)(void (^)());
+@property (nonatomic, copy) void (^backgroundTaskEndBlock)(NSUInteger);
+
++ (WebBackgroundTaskController *)sharedController;
+
+- (NSUInteger)startBackgroundTaskWithExpirationHandler:(void (^)())handler;
+- (void)endBackgroundTaskWithIdentifier:(NSUInteger)identifier;
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformiosWebBackgroundTaskControllermmfromrev211705branchessafari603branchSourceWebKitiosStorageWebSQLiteDatabaseTrackerClientmm"></a>
<div class="copfile"><h4>Copied: branches/safari-603-branch/Source/WebCore/platform/ios/WebBackgroundTaskController.mm (from rev 211705, branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm) (0 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/ios/WebBackgroundTaskController.mm         (rev 0)
+++ branches/safari-603-branch/Source/WebCore/platform/ios/WebBackgroundTaskController.mm        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebBackgroundTaskController.h"
+
+#if PLATFORM(IOS)
+
+@implementation WebBackgroundTaskController
+
++ (WebBackgroundTaskController *)sharedController
+{
+ static WebBackgroundTaskController *sharedController;
+ if (!sharedController)
+ sharedController = [[self alloc] init];
+ return sharedController;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+- (NSUInteger)startBackgroundTaskWithExpirationHandler:(void (^)())handler
+{
+ if (!_backgroundTaskStartBlock)
+ return _invalidBackgroundTaskIdentifier;
+ return _backgroundTaskStartBlock(handler);
+}
+
+- (void)endBackgroundTaskWithIdentifier:(NSUInteger)identifier
+{
+ if (!_backgroundTaskEndBlock)
+ return;
+ _backgroundTaskEndBlock(identifier);
+}
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformiosWebSQLiteDatabaseTrackerClienthfromrev211705branchessafari603branchSourceWebKitiosStorageWebSQLiteDatabaseTrackerClienth"></a>
<div class="copfile"><h4>Copied: branches/safari-603-branch/Source/WebCore/platform/ios/WebSQLiteDatabaseTrackerClient.h (from rev 211705, branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h) (0 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/ios/WebSQLiteDatabaseTrackerClient.h         (rev 0)
+++ branches/safari-603-branch/Source/WebCore/platform/ios/WebSQLiteDatabaseTrackerClient.h        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+/*
+ * Copyright (C) 2010 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "PlatformExportMacros.h"
+
+#if PLATFORM(IOS)
+
+#include "SQLiteDatabaseTrackerClient.h"
+#include <wtf/NeverDestroyed.h>
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class WebSQLiteDatabaseTrackerClient final : public SQLiteDatabaseTrackerClient {
+ WTF_MAKE_NONCOPYABLE(WebSQLiteDatabaseTrackerClient);
+public:
+ WEBCORE_EXPORT static WebSQLiteDatabaseTrackerClient& sharedWebSQLiteDatabaseTrackerClient();
+
+ void willBeginFirstTransaction() override;
+ void didFinishLastTransaction() override;
+
+private:
+ friend class NeverDestroyed<WebSQLiteDatabaseTrackerClient>;
+ WebSQLiteDatabaseTrackerClient();
+ virtual ~WebSQLiteDatabaseTrackerClient();
+};
+
+}
+
+#endif
</ins></span></pre></div>
<a id="branchessafari603branchSourceWebCoreplatformiosWebSQLiteDatabaseTrackerClientmm"></a>
<div class="addfile"><h4>Added: branches/safari-603-branch/Source/WebCore/platform/ios/WebSQLiteDatabaseTrackerClient.mm (0 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebCore/platform/ios/WebSQLiteDatabaseTrackerClient.mm         (rev 0)
+++ branches/safari-603-branch/Source/WebCore/platform/ios/WebSQLiteDatabaseTrackerClient.mm        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -0,0 +1,128 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebSQLiteDatabaseTrackerClient.h"
+
+#if PLATFORM(IOS)
+
+#import "WebBackgroundTaskController.h"
+#import <WebCore/DatabaseTracker.h>
+#import <WebCore/SQLiteDatabaseTracker.h>
+#import <wtf/NeverDestroyed.h>
+
+@interface WebDatabaseTransactionBackgroundTaskController : NSObject
++ (void)startBackgroundTask;
++ (void)endBackgroundTask;
+@end
+
+namespace WebCore {
+
+WebSQLiteDatabaseTrackerClient& WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient()
+{
+ static NeverDestroyed<WebSQLiteDatabaseTrackerClient> client;
+ return client;
+}
+
+WebSQLiteDatabaseTrackerClient::WebSQLiteDatabaseTrackerClient()
+{
+}
+
+WebSQLiteDatabaseTrackerClient::~WebSQLiteDatabaseTrackerClient()
+{
+}
+
+void WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction()
+{
+ [WebDatabaseTransactionBackgroundTaskController startBackgroundTask];
+}
+
+void WebSQLiteDatabaseTrackerClient::didFinishLastTransaction()
+{
+ [WebDatabaseTransactionBackgroundTaskController endBackgroundTask];
+}
+
+}
+
+static Lock& transactionBackgroundTaskIdentifierLock()
+{
+ static NeverDestroyed<Lock> mutex;
+ return mutex;
+}
+
+static NSUInteger transactionBackgroundTaskIdentifier;
+
+static void setTransactionBackgroundTaskIdentifier(NSUInteger identifier)
+{
+ transactionBackgroundTaskIdentifier = identifier;
+}
+
+static NSUInteger getTransactionBackgroundTaskIdentifier()
+{
+ static dispatch_once_t pred;
+ dispatch_once(&pred, ^ {
+ setTransactionBackgroundTaskIdentifier([[WebBackgroundTaskController sharedController] invalidBackgroundTaskIdentifier]);
+ });
+
+ return transactionBackgroundTaskIdentifier;
+}
+
+@implementation WebDatabaseTransactionBackgroundTaskController
+
++ (void)startBackgroundTask
+{
+ LockHolder lock(transactionBackgroundTaskIdentifierLock());
+
+ // If there's already an existing background task going on, there's no need to start a new one.
+ WebBackgroundTaskController *backgroundTaskController = [WebBackgroundTaskController sharedController];
+ if (getTransactionBackgroundTaskIdentifier() != [backgroundTaskController invalidBackgroundTaskIdentifier])
+ return;
+
+ setTransactionBackgroundTaskIdentifier([backgroundTaskController startBackgroundTaskWithExpirationHandler:(^ {
+ WebCore::DatabaseTracker::singleton().closeAllDatabases(WebCore::CurrentQueryBehavior::Interrupt);
+ [self endBackgroundTask];
+ })]);
+}
+
++ (void)endBackgroundTask
+{
+ LockHolder lock(transactionBackgroundTaskIdentifierLock());
+
+ // It is possible that we were unable to start the background task when the first transaction began.
+ // Don't try to end the task in that case.
+ // It is also possible we finally finish the last transaction right when the background task expires
+ // and this will end up being called twice for the same background task. transactionBackgroundTaskIdentifier
+ // will be invalid for the second caller.
+ WebBackgroundTaskController *backgroundTaskController = [WebBackgroundTaskController sharedController];
+ if (getTransactionBackgroundTaskIdentifier() == [backgroundTaskController invalidBackgroundTaskIdentifier])
+ return;
+
+ [backgroundTaskController endBackgroundTaskWithIdentifier:getTransactionBackgroundTaskIdentifier()];
+ setTransactionBackgroundTaskIdentifier([backgroundTaskController invalidBackgroundTaskIdentifier]);
+}
+
+@end
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="branchessafari603branchSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit/ChangeLog (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/ChangeLog        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/ChangeLog        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-02-05 Matthew Hanson <matthew_hanson@apple.com>
+
+ Merge r211551. rdar://problem/26685576
+
+ 2017-02-02 Yongjun Zhang <yongjun_zhang@apple.com>
+
+ In iOS, we should take background assertion when accessing localstorage databases.
+ https://bugs.webkit.org/show_bug.cgi?id=165478
+
+ Reviewed by Brady Eidson.
+
+ * WebKit.xcodeproj/project.pbxproj: Moved WebSQLiteDatabaseTrackerClient to WebCore.
+
</ins><span class="cx"> 2017-01-05 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r210359. rdar://problem/29882478
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -704,8 +704,6 @@
</span><span class="cx">                 A10C1D3C18202FC50036883A /* WebNSStringExtrasIPhone.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D2D18202FC50036883A /* WebNSStringExtrasIPhone.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A10C1D3D18202FC50036883A /* WebUIKitSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D2E18202FC50036883A /* WebUIKitSupport.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A10C1D3E18202FC50036883A /* WebUIKitSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = A10C1D2F18202FC50036883A /* WebUIKitSupport.mm */; };
</span><del>-                A10C1D4218202FEF0036883A /* WebSQLiteDatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D4018202FEF0036883A /* WebSQLiteDatabaseTrackerClient.h */; };
-                A10C1D4318202FEF0036883A /* WebSQLiteDatabaseTrackerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = A10C1D4118202FEF0036883A /* WebSQLiteDatabaseTrackerClient.mm */; };
</del><span class="cx">                 A10C1D5F1820300E0036883A /* PopupMenuIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D451820300E0036883A /* PopupMenuIOS.h */; };
</span><span class="cx">                 A10C1D601820300E0036883A /* PopupMenuIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = A10C1D461820300E0036883A /* PopupMenuIOS.mm */; };
</span><span class="cx">                 A10C1D611820300E0036883A /* SearchPopupMenuIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A10C1D471820300E0036883A /* SearchPopupMenuIOS.cpp */; };
</span><span class="lines">@@ -1449,8 +1447,6 @@
</span><span class="cx">                 A10C1D2D18202FC50036883A /* WebNSStringExtrasIPhone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebNSStringExtrasIPhone.h; path = ios/Misc/WebNSStringExtrasIPhone.h; sourceTree = SOURCE_ROOT; };
</span><span class="cx">                 A10C1D2E18202FC50036883A /* WebUIKitSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebUIKitSupport.h; path = ios/Misc/WebUIKitSupport.h; sourceTree = SOURCE_ROOT; };
</span><span class="cx">                 A10C1D2F18202FC50036883A /* WebUIKitSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebUIKitSupport.mm; path = ios/Misc/WebUIKitSupport.mm; sourceTree = SOURCE_ROOT; };
</span><del>-                A10C1D4018202FEF0036883A /* WebSQLiteDatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebSQLiteDatabaseTrackerClient.h; path = ios/Storage/WebSQLiteDatabaseTrackerClient.h; sourceTree = SOURCE_ROOT; };
-                A10C1D4118202FEF0036883A /* WebSQLiteDatabaseTrackerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebSQLiteDatabaseTrackerClient.mm; path = ios/Storage/WebSQLiteDatabaseTrackerClient.mm; sourceTree = SOURCE_ROOT; };
</del><span class="cx">                 A10C1D451820300E0036883A /* PopupMenuIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PopupMenuIOS.h; path = ios/WebCoreSupport/PopupMenuIOS.h; sourceTree = SOURCE_ROOT; };
</span><span class="cx">                 A10C1D461820300E0036883A /* PopupMenuIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PopupMenuIOS.mm; path = ios/WebCoreSupport/PopupMenuIOS.mm; sourceTree = SOURCE_ROOT; };
</span><span class="cx">                 A10C1D471820300E0036883A /* SearchPopupMenuIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SearchPopupMenuIOS.cpp; path = ios/WebCoreSupport/SearchPopupMenuIOS.cpp; sourceTree = SOURCE_ROOT; };
</span><span class="lines">@@ -1890,7 +1886,6 @@
</span><span class="cx">                 511F3FC30CECC7E200852565 /* Storage */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                A10C1D3F18202FDC0036883A /* ios */,
</del><span class="cx">                                 1A6B31241A51F3A900422975 /* StorageAreaImpl.cpp */,
</span><span class="cx">                                 1A6B31251A51F3A900422975 /* StorageAreaImpl.h */,
</span><span class="cx">                                 1A6B31261A51F3A900422975 /* StorageAreaSync.cpp */,
</span><span class="lines">@@ -2139,15 +2134,6 @@
</span><span class="cx">                         name = ios;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><del>-                A10C1D3F18202FDC0036883A /* ios */ = {
-                        isa = PBXGroup;
-                        children = (
-                                A10C1D4018202FEF0036883A /* WebSQLiteDatabaseTrackerClient.h */,
-                                A10C1D4118202FEF0036883A /* WebSQLiteDatabaseTrackerClient.mm */,
-                        );
-                        name = ios;
-                        sourceTree = "<group>";
-                };
</del><span class="cx">                 A10C1D4418202FFB0036883A /* ios */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -3180,7 +3166,6 @@
</span><span class="cx">                                 A10C1D741820300E0036883A /* WebSelectionRect.h in Headers */,
</span><span class="cx">                                 2DD632C219E5D1F0002E9C7B /* WebSelectionServiceController.h in Headers */,
</span><span class="cx">                                 2D25396618CE85C200270222 /* WebSharingServicePickerController.h in Headers */,
</span><del>-                                A10C1D4218202FEF0036883A /* WebSQLiteDatabaseTrackerClient.h in Headers */,
</del><span class="cx">                                 3AE15D5012DBDED4009323C8 /* WebStorageManagerInternal.h in Headers */,
</span><span class="cx">                                 3AB02B0012C132B200FBB694 /* WebStorageManagerPrivate.h in Headers */,
</span><span class="cx">                                 1A591D461A2E91BB000907C4 /* WebStorageNamespaceProvider.h in Headers */,
</span><span class="lines">@@ -3697,7 +3682,6 @@
</span><span class="cx">                                 A10C1D751820300E0036883A /* WebSelectionRect.m in Sources */,
</span><span class="cx">                                 2DD632C319E5D1F0002E9C7B /* WebSelectionServiceController.mm in Sources */,
</span><span class="cx">                                 2D25396718CE85C200270222 /* WebSharingServicePickerController.mm in Sources */,
</span><del>-                                A10C1D4318202FEF0036883A /* WebSQLiteDatabaseTrackerClient.mm in Sources */,
</del><span class="cx">                                 3AB02AF612C1319B00FBB694 /* WebStorageManager.mm in Sources */,
</span><span class="cx">                                 1A591D451A2E91BB000907C4 /* WebStorageNamespaceProvider.cpp in Sources */,
</span><span class="cx">                                 3ABB3C7B1309C3B500E93D94 /* WebStorageTrackerClient.mm in Sources */,
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit/ios/ChangeLog (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/ios/ChangeLog        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/ios/ChangeLog        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2017-02-05 Matthew Hanson <matthew_hanson@apple.com>
+
+ Merge r211551. rdar://problem/26685576
+
+ 2017-02-02 Yongjun Zhang <yongjun_zhang@apple.com>
+
+ In iOS, we should take background assertion when accessing localstorage databases.
+ https://bugs.webkit.org/show_bug.cgi?id=165478
+
+ Move application background task handling code from WebKit to WebCore.
+
+ Reviewed by Brady Eidson.
+
+ * Misc/WebUIKitSupport.h: Remove several methods that only used internally for background
+ task handling. They are not needed in WebKit any more since background task handling
+ is moved to WebCore and wrapped in WebBackgroundTaskController class.
+ * Misc/WebUIKitSupport.mm:
+ (WebKitSetInvalidWebBackgroundTaskIdentifier): Instead of storing the value in a static global
+ variable, save it in WebBackgroundTaskController.
+ (WebKitSetStartBackgroundTaskBlock): Ditto.
+ (WebKitSetEndBackgroundTaskBlock): Ditto.
+
</ins><span class="cx"> 2016-12-15 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><span class="cx"> Stop reinterpret_casting UBreakIterators to the undefined type TextBreakIterator
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKitiosMiscWebUIKitSupporth"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit/ios/Misc/WebUIKitSupport.h (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/ios/Misc/WebUIKitSupport.h        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/ios/Misc/WebUIKitSupport.h        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -45,11 +45,6 @@
</span><span class="cx"> void WebKitSetStartBackgroundTaskBlock(StartBackgroundTaskBlock);
</span><span class="cx"> void WebKitSetEndBackgroundTaskBlock(EndBackgroundTaskBlock);
</span><span class="cx">
</span><del>-// These methods are what WebKit uses to start/stop background tasks after UIKit has set things up.
-WebBackgroundTaskIdentifier invalidWebBackgroundTaskIdentifier();
-WebBackgroundTaskIdentifier startBackgroundTask(VoidBlock);
-void endBackgroundTask(WebBackgroundTaskIdentifier);
-
</del><span class="cx"> // This method gives WebKit the notifications to listen to so it knows about app Suspend/Resume
</span><span class="cx"> void WebKitSetBackgroundAndForegroundNotificationNames(NSString *, NSString *);
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKitiosMiscWebUIKitSupportmm"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit/ios/Misc/WebUIKitSupport.mm (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/ios/Misc/WebUIKitSupport.mm        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/ios/Misc/WebUIKitSupport.mm        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #import <WebCore/PathUtilities.h>
</span><span class="cx"> #import <WebCore/ResourceRequest.h>
</span><span class="cx"> #import <WebCore/Settings.h>
</span><ins>+#import <WebCore/WebBackgroundTaskController.h>
</ins><span class="cx"> #import <WebCore/WebCoreSystemInterface.h>
</span><span class="cx"> #import <WebCore/WebCoreThreadSystemInterface.h>
</span><span class="cx"> #import <wtf/spi/darwin/dyldSPI.h>
</span><span class="lines">@@ -115,46 +116,21 @@
</span><span class="cx"> // FIXME: Remove this function.
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static WebBackgroundTaskIdentifier invalidTaskIdentifier = 0;
-static StartBackgroundTaskBlock startBackgroundTaskBlock = 0;
-static EndBackgroundTaskBlock endBackgroundTaskBlock = 0;
-
</del><span class="cx"> void WebKitSetInvalidWebBackgroundTaskIdentifier(WebBackgroundTaskIdentifier taskIdentifier)
</span><span class="cx"> {
</span><del>- invalidTaskIdentifier = taskIdentifier;
</del><ins>+ [[WebBackgroundTaskController sharedController] setInvalidBackgroundTaskIdentifier:taskIdentifier];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebKitSetStartBackgroundTaskBlock(StartBackgroundTaskBlock startBlock)
</span><span class="cx"> {
</span><del>- Block_release(startBackgroundTaskBlock);
- startBackgroundTaskBlock = Block_copy(startBlock);
</del><ins>+ [[WebBackgroundTaskController sharedController] setBackgroundTaskStartBlock:startBlock];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebKitSetEndBackgroundTaskBlock(EndBackgroundTaskBlock endBlock)
</span><span class="cx"> {
</span><del>- Block_release(endBackgroundTaskBlock);
- endBackgroundTaskBlock = Block_copy(endBlock);
</del><ins>+ [[WebBackgroundTaskController sharedController] setBackgroundTaskEndBlock:endBlock];
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-WebBackgroundTaskIdentifier invalidWebBackgroundTaskIdentifier()
-{
- return invalidTaskIdentifier;
-}
-
-WebBackgroundTaskIdentifier startBackgroundTask(VoidBlock expirationHandler)
-{
- if (!startBackgroundTaskBlock)
- return invalidTaskIdentifier;
- return startBackgroundTaskBlock(expirationHandler);
-}
-
-void endBackgroundTask(WebBackgroundTaskIdentifier taskIdentifier)
-{
- if (!endBackgroundTaskBlock)
- return;
- endBackgroundTaskBlock(taskIdentifier);
-}
-
</del><span class="cx"> CGPathRef WebKitCreatePathWithShrinkWrappedRects(NSArray* cgRects, CGFloat radius)
</span><span class="cx"> {
</span><span class="cx"> Vector<FloatRect> rects;
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKitiosStorageWebSQLiteDatabaseTrackerClienth"></a>
<div class="delfile"><h4>Deleted: branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -1,39 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <WebCore/SQLiteDatabaseTrackerClient.h>
-
-class WebSQLiteDatabaseTrackerClient : public WebCore::SQLiteDatabaseTrackerClient {
-public:
- static WebSQLiteDatabaseTrackerClient* sharedWebSQLiteDatabaseTrackerClient();
-
- ~WebSQLiteDatabaseTrackerClient() override { }
-
- void willBeginFirstTransaction() override;
- void didFinishLastTransaction() override;
-
-private:
- WebSQLiteDatabaseTrackerClient() { }
-};
</del></span></pre></div>
<a id="branchessafari603branchSourceWebKitiosStorageWebSQLiteDatabaseTrackerClientmm"></a>
<div class="delfile"><h4>Deleted: branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -1,53 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if PLATFORM(IOS)
-
-#import "WebSQLiteDatabaseTrackerClient.h"
-
-#import "WebDatabaseManagerInternal.h"
-#import "WebDatabaseManagerPrivate.h"
-
-#import <WebCore/SQLiteDatabaseTracker.h>
-
-using namespace WebCore;
-
-WebSQLiteDatabaseTrackerClient* WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient()
-{
- static WebSQLiteDatabaseTrackerClient* sharedClient = new WebSQLiteDatabaseTrackerClient();
- return sharedClient;
-}
-
-void WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction()
-{
- [WebDatabaseManager willBeginFirstTransaction];
-}
-
-void WebSQLiteDatabaseTrackerClient::didFinishLastTransaction()
-{
- [WebDatabaseManager didFinishLastTransaction];
-}
-
-#endif // PLATFORM(IOS)
</del></span></pre></div>
<a id="branchessafari603branchSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit/mac/ChangeLog (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/mac/ChangeLog        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/mac/ChangeLog        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2017-02-05 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r211551. rdar://problem/26685576
+
+ 2017-02-02 Yongjun Zhang <yongjun_zhang@apple.com>
+
+ In iOS, we should take background assertion when accessing localstorage databases.
+ https://bugs.webkit.org/show_bug.cgi?id=165478
+
+ Move database transaction background task handling code from WebDatabaseManager to
+ WebCore's WebSQLiteDatabaseTrackerClient.
+
+ Reviewed by Brady Eidson.
+
+ * Storage/WebDatabaseManager.mm:
+ * Storage/WebDatabaseManagerInternal.h: Remove a category for background task handling.
+ * WebCoreSupport/WebApplicationCache.mm:
+ (+[WebApplicationCache initializeWithBundleIdentifier:]): Use WebCore::WebSQLiteDatabaseTrackerClient.
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]): Ditto.
+
+2017-02-05 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r211207. rdar://problem/30154036
</span><span class="cx">
</span><span class="cx"> 2017-01-26 Per Arne Vollan <pvollan@apple.com>
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKitmacStorageWebDatabaseManagermm"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit/mac/Storage/WebDatabaseManager.mm (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/mac/Storage/WebDatabaseManager.mm        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/mac/Storage/WebDatabaseManager.mm        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -234,77 +234,6 @@
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><del>-#if PLATFORM(IOS)
-
-@implementation WebDatabaseManager (WebDatabaseManagerInternal)
-
-static Lock& transactionBackgroundTaskIdentifierLock()
-{
- static NeverDestroyed<Lock> mutex;
- return mutex;
-}
-
-static WebBackgroundTaskIdentifier transactionBackgroundTaskIdentifier;
-
-static void setTransactionBackgroundTaskIdentifier(WebBackgroundTaskIdentifier identifier)
-{
- transactionBackgroundTaskIdentifier = identifier;
-}
-
-static WebBackgroundTaskIdentifier getTransactionBackgroundTaskIdentifier()
-{
- static dispatch_once_t pred;
- dispatch_once(&pred, ^{
- setTransactionBackgroundTaskIdentifier(invalidWebBackgroundTaskIdentifier());
- });
-
- return transactionBackgroundTaskIdentifier;
-}
-
-+ (void)willBeginFirstTransaction
-{
- [self startBackgroundTask];
-}
-
-+ (void)didFinishLastTransaction
-{
- [self endBackgroundTask];
-}
-
-+ (void)startBackgroundTask
-{
- LockHolder lock(transactionBackgroundTaskIdentifierLock());
-
- // If there's already an existing background task going on, there's no need to start a new one.
- if (getTransactionBackgroundTaskIdentifier() != invalidWebBackgroundTaskIdentifier())
- return;
-
- setTransactionBackgroundTaskIdentifier(startBackgroundTask(^ {
- DatabaseTracker::singleton().closeAllDatabases(CurrentQueryBehavior::Interrupt);
- [WebDatabaseManager endBackgroundTask];
- }));
-}
-
-+ (void)endBackgroundTask
-{
- LockHolder lock(transactionBackgroundTaskIdentifierLock());
-
- // It is possible that we were unable to start the background task when the first transaction began.
- // Don't try to end the task in that case.
- // It is also possible we finally finish the last transaction right when the background task expires
- // and this will end up being called twice for the same background task. transactionBackgroundTaskIdentifier
- // will be invalid for the second caller.
- if (getTransactionBackgroundTaskIdentifier() == invalidWebBackgroundTaskIdentifier())
- return;
-
- endBackgroundTask(getTransactionBackgroundTaskIdentifier());
- setTransactionBackgroundTaskIdentifier(invalidWebBackgroundTaskIdentifier());
-}
-
-@end
-
-#endif // PLATFORM(IOS)
-
</del><span class="cx"> static NSString *databasesDirectoryPath()
</span><span class="cx"> {
</span><span class="cx"> NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKitmacStorageWebDatabaseManagerInternalh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/mac/Storage/WebDatabaseManagerInternal.h        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -27,13 +27,3 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #import "WebDatabaseManagerPrivate.h"
</span><del>-
-#if PLATFORM(IOS)
-@interface WebDatabaseManager (WebDatabaseManagerInternal)
-+ (void)willBeginFirstTransaction;
-+ (void)didFinishLastTransaction;
-+ (void)startBackgroundTask;
-+ (void)endBackgroundTask;
-@end
-
-#endif
</del></span></pre></div>
<a id="branchessafari603branchSourceWebKitmacWebCoreSupportWebApplicationCachemm"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -33,9 +33,9 @@
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-#import "WebSQLiteDatabaseTrackerClient.h"
</del><span class="cx"> #import <WebCore/RuntimeApplicationChecks.h>
</span><span class="cx"> #import <WebCore/SQLiteDatabaseTracker.h>
</span><ins>+#import <WebCore/WebSQLiteDatabaseTrackerClient.h>
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> if (initialized)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- SQLiteDatabaseTracker::setClient(WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient());
</del><ins>+ SQLiteDatabaseTracker::setClient(&WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient());
</ins><span class="cx">
</span><span class="cx"> ASSERT(!overrideBundleIdentifier);
</span><span class="cx"> overrideBundleIdentifier = [bundleIdentifier copy];
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit/mac/WebView/WebView.mm (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit/mac/WebView/WebView.mm        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit/mac/WebView/WebView.mm        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -256,7 +256,6 @@
</span><span class="cx"> #import "WebPlainWhiteView.h"
</span><span class="cx"> #import "WebPluginController.h"
</span><span class="cx"> #import "WebPolicyDelegatePrivate.h"
</span><del>-#import "WebSQLiteDatabaseTrackerClient.h"
</del><span class="cx"> #import "WebStorageManagerPrivate.h"
</span><span class="cx"> #import "WebUIKitSupport.h"
</span><span class="cx"> #import "WebVisiblePosition.h"
</span><span class="lines">@@ -279,6 +278,7 @@
</span><span class="cx"> #import <WebCore/WebCoreThreadMessage.h>
</span><span class="cx"> #import <WebCore/WebCoreThreadRun.h>
</span><span class="cx"> #import <WebCore/WebEvent.h>
</span><ins>+#import <WebCore/WebSQLiteDatabaseTrackerClient.h>
</ins><span class="cx"> #import <WebCore/WebVideoFullscreenControllerAVKit.h>
</span><span class="cx"> #import <libkern/OSAtomic.h>
</span><span class="cx"> #import <wtf/FastMalloc.h>
</span><span class="lines">@@ -1312,7 +1312,7 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> // Set the WebSQLiteDatabaseTrackerClient.
</span><del>- SQLiteDatabaseTracker::setClient(WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient());
</del><ins>+ SQLiteDatabaseTracker::setClient(&WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient());
</ins><span class="cx">
</span><span class="cx"> if ([standardPreferences databasesEnabled])
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/ChangeLog (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/ChangeLog        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit2/ChangeLog        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -1,5 +1,25 @@
</span><span class="cx"> 2017-02-05 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r211551. rdar://problem/26685576
+
+ 2017-02-02 Yongjun Zhang <yongjun_zhang@apple.com>
+
+ In iOS, we should take background assertion when accessing localstorage databases.
+ https://bugs.webkit.org/show_bug.cgi?id=165478
+
+ Just like in WebKit1, when initializing a WKWebView, initialize the database transaction
+ tracker client. Also, we should set up the start and end background task blocks here. In
+ WebKit1, this is done inside UIKit.
+
+ Reviewed by Brady Eidson.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _initializeWithConfiguration:]):
+ (-[WKWebView _setUpSQLiteDatabaseTrackerClient]): Set up the start/end background task blocks
+ and database transaction tracker client.
+
+2017-02-05 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r211656. rdar://problem/30102568
</span><span class="cx">
</span><span class="cx"> 2017-02-03 Daniel Bates <dabates@apple.com>
</span></span></pre></div>
<a id="branchessafari603branchSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (211705 => 211706)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2017-02-06 06:17:12 UTC (rev 211705)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2017-02-06 06:17:20 UTC (rev 211706)
</span><span class="lines">@@ -92,9 +92,12 @@
</span><span class="cx"> #import <WebCore/NSTextFinderSPI.h>
</span><span class="cx"> #import <WebCore/PlatformScreen.h>
</span><span class="cx"> #import <WebCore/RuntimeApplicationChecks.h>
</span><ins>+#import <WebCore/SQLiteDatabaseTracker.h>
</ins><span class="cx"> #import <WebCore/Settings.h>
</span><span class="cx"> #import <WebCore/TextStream.h>
</span><span class="cx"> #import <WebCore/ValidationBubble.h>
</span><ins>+#import <WebCore/WebBackgroundTaskController.h>
+#import <WebCore/WebSQLiteDatabaseTrackerClient.h>
</ins><span class="cx"> #import <WebCore/WritingMode.h>
</span><span class="cx"> #import <wtf/HashMap.h>
</span><span class="cx"> #import <wtf/MathExtras.h>
</span><span class="lines">@@ -579,9 +582,34 @@
</span><span class="cx"> _page->setFullscreenClient(std::make_unique<WebKit::FullscreenClient>(self));
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+ [self _setUpSQLiteDatabaseTrackerClient];
+#endif
+
</ins><span class="cx"> pageToViewMap().add(_page.get(), self);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)_setUpSQLiteDatabaseTrackerClient
+{
+#if PLATFORM(IOS)
+ WebBackgroundTaskController *controller = [WebBackgroundTaskController sharedController];
+ if (controller.backgroundTaskStartBlock)
+ return;
+
+ controller.backgroundTaskStartBlock = ^NSUInteger (void (^expirationHandler)())
+ {
+ return [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:expirationHandler];
+ };
+ controller.backgroundTaskEndBlock = ^(UIBackgroundTaskIdentifier taskIdentifier)
+ {
+ [[UIApplication sharedApplication] endBackgroundTask:taskIdentifier];
+ };
+ controller.invalidBackgroundTaskIdentifier = UIBackgroundTaskInvalid;
+
+ WebCore::SQLiteDatabaseTracker::setClient(&WebCore::WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient());
+#endif
+}
+
</ins><span class="cx"> - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration
</span><span class="cx"> {
</span><span class="cx"> if (!(self = [super initWithFrame:frame]))
</span></span></pre>
</div>
</div>
</body>
</html>