WebKit Bugzilla
Attachment 357323 Details for
Bug 192707
: clang-tidy: Fix unnecessary object copy in CPUMonitor::setCPULimit()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch v1
bug-192707-20181214105623.patch (text/plain), 3.61 KB, created by
David Kilzer (:ddkilzer)
on 2018-12-14 10:56:24 PST
(
hide
)
Description:
Patch v1
Filename:
MIME Type:
Creator:
David Kilzer (:ddkilzer)
Created:
2018-12-14 10:56:24 PST
Size:
3.61 KB
patch
obsolete
>Subversion Revision: 239112 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 88f7eddc26957c3e5de8628c2edf1fd0742d0379..1d451e16a4b62a6ab547b3374efe85365b70689c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2018-12-14 David Kilzer <ddkilzer@apple.com> >+ >+ clang-tidy: Fix unnecessary object copy in CPUMonitor::setCPULimit() >+ <https://webkit.org/b/192707> >+ <rdar://problem/46734926> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/CPUMonitor.cpp: >+ (WebCore::CPUMonitor::setCPULimit): >+ * platform/CPUMonitor.h: >+ (WebCore::CPUMonitor::setCPULimit): >+ - Change parameter to const reference to fix unnecessary copies. >+ > 2018-12-13 David Kilzer <ddkilzer@apple.com> > > clang-tidy: loop variable is copied but only used as const reference in Document.cpp, Element.cpp >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index c178af766a185f8ddb469864526c7bf1cc12d503..f81a9a8b3f1c711faeb498ce590660aa9ebf0074 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,16 @@ >+2018-12-14 David Kilzer <ddkilzer@apple.com> >+ >+ clang-tidy: Fix unnecessary object copy in CPUMonitor::setCPULimit() >+ <https://webkit.org/b/192707> >+ <rdar://problem/46734926> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/cocoa/WebProcessCocoa.mm: >+ (WebKit::WebProcess::updateCPUMonitorState): >+ - Pass m_cpuLimit directly since getting its value causes an >+ identical std::optional<double> to be created unnecessarily. >+ > 2018-12-12 Chris Dumez <cdumez@apple.com> > > Unreviewed attempt to fix build with older SDKs after r239110. >diff --git a/Source/WebCore/platform/CPUMonitor.cpp b/Source/WebCore/platform/CPUMonitor.cpp >index 5faaf66e602e77e1d9b21765390e14f37ac8a7fb..e275673ccb4b206e794abd6a27a443c4c73c5283 100644 >--- a/Source/WebCore/platform/CPUMonitor.cpp >+++ b/Source/WebCore/platform/CPUMonitor.cpp >@@ -35,7 +35,7 @@ CPUMonitor::CPUMonitor(Seconds checkInterval, ExceededCPULimitHandler&& exceeded > { > } > >-void CPUMonitor::setCPULimit(std::optional<double> cpuLimit) >+void CPUMonitor::setCPULimit(const std::optional<double>& cpuLimit) > { > if (m_cpuLimit == cpuLimit) > return; >diff --git a/Source/WebCore/platform/CPUMonitor.h b/Source/WebCore/platform/CPUMonitor.h >index d4ddb778d6d4e6afd8d2e2ff4bab92958a568447..6ec486f3f93a4135ab5f57b3c772c45e99d09543 100644 >--- a/Source/WebCore/platform/CPUMonitor.h >+++ b/Source/WebCore/platform/CPUMonitor.h >@@ -37,7 +37,7 @@ public: > using ExceededCPULimitHandler = WTF::Function<void(double)>; > WEBCORE_EXPORT CPUMonitor(Seconds checkInterval, ExceededCPULimitHandler&&); > >- WEBCORE_EXPORT void setCPULimit(std::optional<double>); >+ WEBCORE_EXPORT void setCPULimit(const std::optional<double>&); > > private: > void timerFired(); >diff --git a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >index bdae746d5d48e580d33ba9ecda363615f93b9f6c..3ae499c834cd96ef83081d84f1f8655a09d11996 100644 >--- a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >+++ b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >@@ -569,7 +569,7 @@ void WebProcess::updateCPUMonitorState(CPUMonitorUpdateReason reason) > // not want to report that a process has exceeded its background CPU limit even though most of the CPU time was used while the process was visible. > m_cpuMonitor->setCPULimit(std::nullopt); > } >- m_cpuMonitor->setCPULimit(m_cpuLimit.value()); >+ m_cpuMonitor->setCPULimit(m_cpuLimit); > #else > UNUSED_PARAM(reason); > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192707
: 357323