Title: [222719] trunk/Source/WebCore
Revision
222719
Author
[email protected]
Date
2017-10-02 10:52:52 -0700 (Mon, 02 Oct 2017)

Log Message

Use ThreadIdentifier instead of thread::this_thread::get_id
https://bugs.webkit.org/show_bug.cgi?id=177729

Reviewed by Sam Weinig.

We can use WTF::ThreadIdentifier instead of thread::this_thread::get_id
to make use of ThreadIdentifier consistent in WebKit. In the other places,
we use ThreadIdentifier for this debugging purpose. And this is the only
place using thread::this_thread::get_id for the exact same purpose.
Furthermore, thread::this_thread::get_id in Windows platform. So we prefer
using ThreadIdentifier than thread::this_thread::get_id.

* Modules/webdatabase/DatabaseDetails.h:
(WebCore::DatabaseDetails::DatabaseDetails):
(WebCore::DatabaseDetails::threadID const):
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::detailsForNameAndOrigin):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (222718 => 222719)


--- trunk/Source/WebCore/ChangeLog	2017-10-02 17:35:10 UTC (rev 222718)
+++ trunk/Source/WebCore/ChangeLog	2017-10-02 17:52:52 UTC (rev 222719)
@@ -1,3 +1,23 @@
+2017-10-02  Yusuke Suzuki  <[email protected]>
+
+        Use ThreadIdentifier instead of thread::this_thread::get_id
+        https://bugs.webkit.org/show_bug.cgi?id=177729
+
+        Reviewed by Sam Weinig.
+
+        We can use WTF::ThreadIdentifier instead of thread::this_thread::get_id
+        to make use of ThreadIdentifier consistent in WebKit. In the other places,
+        we use ThreadIdentifier for this debugging purpose. And this is the only
+        place using thread::this_thread::get_id for the exact same purpose.
+        Furthermore, thread::this_thread::get_id in Windows platform. So we prefer
+        using ThreadIdentifier than thread::this_thread::get_id.
+
+        * Modules/webdatabase/DatabaseDetails.h:
+        (WebCore::DatabaseDetails::DatabaseDetails):
+        (WebCore::DatabaseDetails::threadID const):
+        * Modules/webdatabase/DatabaseManager.cpp:
+        (WebCore::DatabaseManager::detailsForNameAndOrigin):
+
 2017-10-02  Antti Koivisto  <[email protected]>
 
         Fix memory leaks in RenderMultiColumnFlow

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseDetails.h (222718 => 222719)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseDetails.h	2017-10-02 17:35:10 UTC (rev 222718)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseDetails.h	2017-10-02 17:52:52 UTC (rev 222719)
@@ -28,7 +28,7 @@
 
 #pragma once
 
-#include <thread>
+#include <wtf/Threading.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -41,7 +41,7 @@
         , m_creationTime(0)
         , m_modificationTime(0)
 #ifndef NDEBUG
-        , m_threadID(std::this_thread::get_id())
+        , m_threadID(Thread::currentID())
 #endif
     {
     }
@@ -54,7 +54,7 @@
         , m_creationTime(creationTime)
         , m_modificationTime(modificationTime)
 #ifndef NDEBUG
-        , m_threadID(std::this_thread::get_id())
+        , m_threadID(Thread::currentID())
 #endif
     {
     }
@@ -66,7 +66,7 @@
     double creationTime() const { return m_creationTime; }
     double modificationTime() const { return m_modificationTime; }
 #ifndef NDEBUG
-    std::thread::id threadID() const { return m_threadID; }
+    ThreadIdentifier threadID() const { return m_threadID; }
 #endif
 
 private:
@@ -77,7 +77,7 @@
     double m_creationTime;
     double m_modificationTime;
 #ifndef NDEBUG
-    std::thread::id m_threadID;
+    ThreadIdentifier m_threadID;
 #endif
 };
 

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp (222718 => 222719)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp	2017-10-02 17:35:10 UTC (rev 222718)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp	2017-10-02 17:52:52 UTC (rev 222719)
@@ -257,7 +257,7 @@
         std::lock_guard<Lock> lock { m_proposedDatabasesMutex };
         for (auto* proposedDatabase : m_proposedDatabases) {
             if (proposedDatabase->details().name() == name && proposedDatabase->origin().equal(&origin)) {
-                ASSERT(proposedDatabase->details().threadID() == std::this_thread::get_id() || isMainThread());
+                ASSERT(proposedDatabase->details().threadID() == Thread::currentID() || isMainThread());
                 return proposedDatabase->details();
             }
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to