Title: [259579] trunk/Source/WebKit
Revision
259579
Author
[email protected]
Date
2020-04-06 11:07:25 -0700 (Mon, 06 Apr 2020)

Log Message

ProcessAssertion should use ASCIILiteral for its reason
https://bugs.webkit.org/show_bug.cgi?id=210049

Reviewed by Alex Christensen.

ProcessAssertion should use ASCIILiteral for its reason, instead of a String.

* Shared/ios/DependencyProcessAssertionIOS.mm:
(WebKit::DependencyProcessAssertion::DependencyProcessAssertion):
* UIProcess/ProcessAssertion.cpp:
(WebKit::ProcessAssertion::ProcessAssertion):
* UIProcess/ProcessAssertion.h:
* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::ProcessAssertion):
(WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (259578 => 259579)


--- trunk/Source/WebKit/ChangeLog	2020-04-06 17:47:38 UTC (rev 259578)
+++ trunk/Source/WebKit/ChangeLog	2020-04-06 18:07:25 UTC (rev 259579)
@@ -1,3 +1,21 @@
+2020-04-06  Chris Dumez  <[email protected]>
+
+        ProcessAssertion should use ASCIILiteral for its reason
+        https://bugs.webkit.org/show_bug.cgi?id=210049
+
+        Reviewed by Alex Christensen.
+
+        ProcessAssertion should use ASCIILiteral for its reason, instead of a String.
+
+        * Shared/ios/DependencyProcessAssertionIOS.mm:
+        (WebKit::DependencyProcessAssertion::DependencyProcessAssertion):
+        * UIProcess/ProcessAssertion.cpp:
+        (WebKit::ProcessAssertion::ProcessAssertion):
+        * UIProcess/ProcessAssertion.h:
+        * UIProcess/ios/ProcessAssertionIOS.mm:
+        (WebKit::ProcessAssertion::ProcessAssertion):
+        (WebKit::ProcessAndUIAssertion::ProcessAndUIAssertion):
+
 2020-04-04  Darin Adler  <[email protected]>
 
         Stop using live ranges in DocumentMarkerController

Modified: trunk/Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm (259578 => 259579)


--- trunk/Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm	2020-04-06 17:47:38 UTC (rev 259578)
+++ trunk/Source/WebKit/Shared/ios/DependencyProcessAssertionIOS.mm	2020-04-06 18:07:25 UTC (rev 259579)
@@ -36,7 +36,9 @@
 {
     RBSTarget *target = [RBSTarget targetWithPid:targetPID];
     RBSDomainAttribute *domainAttribute = [RBSDomainAttribute attributeWithDomain:@"com.apple.webkit" name:@"DependentProcessLink"];
-    m_assertion = adoptNS([[RBSAssertion alloc] initWithExplanation:String { description } target:target attributes:@[domainAttribute]]);
+
+    NSString *nsDescription = [NSString stringWithCString:description.characters() encoding:NSASCIIStringEncoding];
+    m_assertion = adoptNS([[RBSAssertion alloc] initWithExplanation:nsDescription target:target attributes:@[domainAttribute]]);
     NSError *acquisitionError = nil;
     if (![m_assertion acquireWithError:&acquisitionError])
         RELEASE_LOG_ERROR(Process, "DependencyProcessAssertion::DependencyProcessAssertion: Failed to acquire dependency process assertion '%{public}s', error: %{public}@", description.characters(), acquisitionError);

Modified: trunk/Source/WebKit/UIProcess/ProcessAssertion.cpp (259578 => 259579)


--- trunk/Source/WebKit/UIProcess/ProcessAssertion.cpp	2020-04-06 17:47:38 UTC (rev 259578)
+++ trunk/Source/WebKit/UIProcess/ProcessAssertion.cpp	2020-04-06 18:07:25 UTC (rev 259579)
@@ -32,7 +32,7 @@
 
 namespace WebKit {
 
-ProcessAssertion::ProcessAssertion(ProcessID, const String&, ProcessAssertionType assertionType)
+ProcessAssertion::ProcessAssertion(ProcessID, ASCIILiteral, ProcessAssertionType assertionType)
     : m_assertionType(assertionType)
 {
 }

Modified: trunk/Source/WebKit/UIProcess/ProcessAssertion.h (259578 => 259579)


--- trunk/Source/WebKit/UIProcess/ProcessAssertion.h	2020-04-06 17:47:38 UTC (rev 259578)
+++ trunk/Source/WebKit/UIProcess/ProcessAssertion.h	2020-04-06 18:07:25 UTC (rev 259579)
@@ -58,7 +58,7 @@
         virtual void uiAssertionWillExpireImminently() = 0;
     };
 
-    ProcessAssertion(ProcessID, const String& reason, ProcessAssertionType);
+    ProcessAssertion(ProcessID, ASCIILiteral reason, ProcessAssertionType);
     virtual ~ProcessAssertion();
 
     void setClient(Client& client) { m_client = &client; }
@@ -87,7 +87,7 @@
 
 class ProcessAndUIAssertion final : public ProcessAssertion {
 public:
-    ProcessAndUIAssertion(ProcessID, const String& reason, ProcessAssertionType);
+    ProcessAndUIAssertion(ProcessID, ASCIILiteral reason, ProcessAssertionType);
     ~ProcessAndUIAssertion();
 
     void uiAssertionWillExpireImminently();

Modified: trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm (259578 => 259579)


--- trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm	2020-04-06 17:47:38 UTC (rev 259578)
+++ trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm	2020-04-06 18:07:25 UTC (rev 259579)
@@ -299,7 +299,7 @@
     }
 }
 
-ProcessAssertion::ProcessAssertion(pid_t pid, const String& name, ProcessAssertionType assertionType)
+ProcessAssertion::ProcessAssertion(pid_t pid, ASCIILiteral reason, ProcessAssertionType assertionType)
     : m_assertionType(assertionType)
 {
     auto weakThis = makeWeakPtr(*this);
@@ -312,9 +312,11 @@
             });
         }
     };
-    RELEASE_LOG(ProcessSuspension, "%p - ProcessAssertion() PID %d acquiring assertion for process with PID %d, name '%s'", this, getpid(), pid, name.utf8().data());
+    RELEASE_LOG(ProcessSuspension, "%p - ProcessAssertion() PID %d acquiring assertion for process with PID %d, name '%s'", this, getpid(), pid, reason.characters());
     
-    m_assertion = adoptNS([[BKSProcessAssertion alloc] initWithPID:pid flags:flagsForAssertionType(assertionType) reason:toBKSProcessAssertionReason(assertionType) name:(NSString *)name withHandler:handler]);
+    NSString *nsReason = [NSString stringWithCString:reason.characters() encoding:NSASCIIStringEncoding];
+    m_assertion = adoptNS([[BKSProcessAssertion alloc] initWithPID:pid flags:flagsForAssertionType(assertionType) reason:toBKSProcessAssertionReason(assertionType) name:nsReason withHandler:handler]);
+
     m_assertion.get().invalidationHandler = ^() {
         dispatch_async(dispatch_get_main_queue(), ^{
             RELEASE_LOG(ProcessSuspension, "%p - ProcessAssertion() Process assertion for process with PID %d was invalidated", this, pid);
@@ -354,7 +356,7 @@
     m_isHoldingBackgroundTask = shouldHoldBackgroundTask;
 }
 
-ProcessAndUIAssertion::ProcessAndUIAssertion(pid_t pid, const String& reason, ProcessAssertionType assertionType)
+ProcessAndUIAssertion::ProcessAndUIAssertion(pid_t pid, ASCIILiteral reason, ProcessAssertionType assertionType)
     : ProcessAssertion(pid, reason, assertionType)
 {
     updateRunInBackgroundCount();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to