[Win] Build fix after r223206
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Oct 2017 18:21:05 +0000 (18:21 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Oct 2017 18:21:05 +0000 (18:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171523

Unreviewed.

* pal/PlatformWin.cmake:
* pal/win/LoggingWin.cpp: Added.
(PAL::logLevelString):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223241 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/PlatformWin.cmake
Source/WebCore/PAL/pal/win/LoggingWin.cpp [new file with mode: 0644]

index c9207aa..abafdd3 100644 (file)
@@ -1,3 +1,14 @@
+2017-10-12  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Win] Build fix after r223206
+        https://bugs.webkit.org/show_bug.cgi?id=171523
+
+        Unreviewed.
+
+        * pal/PlatformWin.cmake:
+        * pal/win/LoggingWin.cpp: Added.
+        (PAL::logLevelString):
+
 2017-10-11  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Allow PAL to log messages
index 1e68d4e..c2304e1 100644 (file)
@@ -6,6 +6,8 @@ list(APPEND PAL_SOURCES
     system/win/SoundWin.cpp
 
     text/KillRing.cpp
+
+    win/LoggingWin.cpp
 )
 
 list(APPEND PAL_INCLUDE_DIRECTORIES
diff --git a/Source/WebCore/PAL/pal/win/LoggingWin.cpp b/Source/WebCore/PAL/pal/win/LoggingWin.cpp
new file mode 100644 (file)
index 0000000..8ca4c96
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2008, 2013 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.
+ */
+
+#include "config.h"
+#include "Logging.h"
+
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
+
+#include <windows.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/text/WTFString.h>
+
+namespace PAL {
+
+static char * const loggingEnvironmentVariable = "WebCoreLogging";
+
+String logLevelString()
+{
+    DWORD length = GetEnvironmentVariableA(loggingEnvironmentVariable, 0, 0);
+    if (!length)
+        return emptyString();
+
+    auto buffer = std::make_unique<char[]>(length);
+
+    if (!GetEnvironmentVariableA(loggingEnvironmentVariable, buffer.get(), length))
+        return emptyString();
+
+    return String(buffer.get());
+}
+
+}
+
+#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED