WebCore/ChangeLog

 12010-03-30 Jian Li <jianli@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Add support to create UUID string.
 6 https://bugs.webkit.org/show_bug.cgi?id=36472
 7
 8 * GNUmakefile.am:
 9 * WebCore.gypi:
 10 * WebCore.pro:
 11 * WebCore.vcproj/WebCore.vcproj:
 12 * WebCore.xcodeproj/project.pbxproj:
 13 * platform/UUID.cpp: Added.
 14 (WebCore::createCanonicalUUIDString):
 15 * platform/UUID.h: Added.
 16
1172010-03-30 Sam Weinig <sam@webkit.org>
218
319 Reviewed by Anders Carlsson.

WebCore/GNUmakefile.am

@@webcore_sources += \
15541554 WebCore/platform/Timer.cpp \
15551555 WebCore/platform/Timer.h \
15561556 WebCore/platform/TreeShared.h \
 1557 WebCore/platform/UUID.cpp \
 1558 WebCore/platform/UUID.h \
15571559 WebCore/platform/Widget.cpp \
15581560 WebCore/platform/Widget.h \
15591561 WebCore/platform/WindowsKeyboardCodes.h \

WebCore/WebCore.gypi

28992899 'platform/Timer.cpp',
29002900 'platform/Timer.h',
29012901 'platform/TreeShared.h',
 2902 'platform/UUID.cpp',
 2903 'platform/UUID.h',
29022904 'platform/Widget.cpp',
29032905 'platform/Widget.h',
29042906 'platform/WindowsKeyboardCodes.h',

WebCore/WebCore.pro

@@SOURCES += \
895895 platform/ThreadTimers.cpp \
896896 platform/Timer.cpp \
897897 platform/text/UnicodeRange.cpp \
 898 platform/UUID.cpp \
898899 platform/Widget.cpp \
899900 plugins/PluginDatabase.cpp \
900901 plugins/PluginDebug.cpp \

WebCore/WebCore.vcproj/WebCore.vcproj

2214122141 >
2214222142 </File>
2214322143 <File
 22144 RelativePath="..\platform\UUID.cpp"
 22145 >
 22146 </File>
 22147 <File
 22148 RelativePath="..\platform\UUID.h"
 22149 >
 22150 </File>
 22151 <File
2214422152 RelativePath="..\platform\Widget.cpp"
2214522153 >
2214622154 </File>

WebCore/WebCore.xcodeproj/project.pbxproj

605605 2E2D99EA10E2BC3800496337 /* DOMBlobInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E2D99E910E2BC3800496337 /* DOMBlobInternal.h */; };
606606 2E2D99EB10E2BD3900496337 /* DOMBlob.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 2E2D99E510E2BC1C00496337 /* DOMBlob.h */; };
607607 2E2D99EC10E2BD3900496337 /* DOMBlobInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 2E2D99E910E2BC3800496337 /* DOMBlobInternal.h */; };
 608 2E3BBF071162DA1100B9409A /* UUID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E3BBF051162DA1100B9409A /* UUID.cpp */; };
 609 2E3BBF081162DA1100B9409A /* UUID.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E3BBF061162DA1100B9409A /* UUID.h */; };
608610 2E4346440F546A8200B0F1BA /* GenericWorkerTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E4346320F546A8200B0F1BA /* GenericWorkerTask.h */; };
609611 2E4346450F546A8200B0F1BA /* Worker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E4346330F546A8200B0F1BA /* Worker.cpp */; };
610612 2E4346460F546A8200B0F1BA /* Worker.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E4346340F546A8200B0F1BA /* Worker.h */; };

59965998 2E2D99E510E2BC1C00496337 /* DOMBlob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMBlob.h; sourceTree = "<group>"; };
59975999 2E2D99E610E2BC1C00496337 /* DOMBlob.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMBlob.mm; sourceTree = "<group>"; };
59986000 2E2D99E910E2BC3800496337 /* DOMBlobInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMBlobInternal.h; sourceTree = "<group>"; };
 6001 2E3BBF051162DA1100B9409A /* UUID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UUID.cpp; sourceTree = "<group>"; };
 6002 2E3BBF061162DA1100B9409A /* UUID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UUID.h; sourceTree = "<group>"; };
59996003 2E4346320F546A8200B0F1BA /* GenericWorkerTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GenericWorkerTask.h; path = workers/GenericWorkerTask.h; sourceTree = "<group>"; };
60006004 2E4346330F546A8200B0F1BA /* Worker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Worker.cpp; path = workers/Worker.cpp; sourceTree = "<group>"; };
60016005 2E4346340F546A8200B0F1BA /* Worker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Worker.h; path = workers/Worker.h; sourceTree = "<group>"; };

1542215426 93309EA1099EB78C0056E581 /* Timer.cpp */,
1542315427 9305B24C098F1B6B00C28855 /* Timer.h */,
1542415428 1419D2C40CEA6F6100FF507A /* TreeShared.h */,
 15429 2E3BBF051162DA1100B9409A /* UUID.cpp */,
 15430 2E3BBF061162DA1100B9409A /* UUID.h */,
1542515431 9380F47109A11AB4001FDB34 /* Widget.cpp */,
1542615432 9380F47209A11AB4001FDB34 /* Widget.h */,
1542715433 E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */,

1876818774 E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */,
1876918775 E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */,
1877018776 8499A515115FB33000F566E3 /* RenderSVGResourceMarker.h in Headers */,
 18777 2E3BBF081162DA1100B9409A /* UUID.h in Headers */,
1877118778 );
1877218779 runOnlyForDeploymentPostprocessing = 0;
1877318780 };

2098220989 62CD32591157E57C0063B0A7 /* CustomEvent.cpp in Sources */,
2098320990 E4778B7F115A581A00B5D372 /* JSCustomEvent.cpp in Sources */,
2098420991 8499A514115FB33000F566E3 /* RenderSVGResourceMarker.cpp in Sources */,
 20992 2E3BBF071162DA1100B9409A /* UUID.cpp in Sources */,
2098520993 );
2098620994 runOnlyForDeploymentPostprocessing = 0;
2098720995 };

WebCore/platform/UUID.cpp

 1/*
 2* Copyright (C) 2010 Google Inc. All rights reserved.
 3*
 4* Redistribution and use in source and binary forms, with or without
 5* modification, are permitted provided that the following conditions are
 6* met:
 7*
 8* * Redistributions of source code must retain the above copyright
 9* notice, this list of conditions and the following disclaimer.
 10 * * Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer
 12 * in the documentation and/or other materials provided with the
 13 * distribution.
 14 * * Neither the name of Google Inc. nor the names of its
 15 * contributors may be used to endorse or promote products derived from
 16 * this software without specific prior written permission.
 17 *
 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 29 */
 30
 31#include "config.h"
 32#include "UUID.h"
 33
 34#include "NotImplemented.h"
 35
 36#if OS(WINDOWS)
 37#include <objbase.h>
 38#elif OS(DARWIN)
 39#include <CoreFoundation/CoreFoundation.h>
 40#elif OS(LINUX)
 41#include <stdio.h>
 42#endif
 43
 44namespace WebCore {
 45
 46String createCanonicalUUIDString()
 47{
 48#if OS(WINDOWS)
 49 GUID uuid = { 0 };
 50 HRESULT hr = CoCreateGuid(&uuid);
 51 if (FAILED(hr))
 52 return String();
 53 wchar_t uuidStr[40];
 54 int num = StringFromGUID2(uuid, reinterpret_cast<LPOLESTR>(uuidStr), ARRAYSIZE(uuidStr));
 55 ASSERT(num == 39);
 56 return String(uuidStr + 1, num - 3).lower(); // remove opening and closing bracket and make it lower.
 57#elif OS(DARWIN)
 58 CFUUIDRef uuid = CFUUIDCreate(0);
 59 CFStringRef uuidStrRef = CFUUIDCreateString(0, uuid);
 60 String uuidStr(uuidStrRef);
 61 CFRelease(uuidStrRef);
 62 CFRelease(uuid);
 63 return uuidStr.lower(); // make it lower.
 64#elif OS(LINUX)
 65 FILE* fptr = fopen("/proc/sys/kernel/random/uuid", "r");
 66 if (!fptr)
 67 return String();
 68 char uuidStr[37] = {0};
 69 fgets(uuidStr, sizeof(uuidStr) - 1, fptr);
 70 fclose(fptr);
 71 return String(uuidStr);
 72#else
 73 notImplemented();
 74 return String();
 75#endif
 76}
 77
 78}

WebCore/platform/UUID.h

 1/*
 2* Copyright (C) 2010 Google Inc. All rights reserved.
 3*
 4* Redistribution and use in source and binary forms, with or without
 5* modification, are permitted provided that the following conditions are
 6* met:
 7*
 8* * Redistributions of source code must retain the above copyright
 9* notice, this list of conditions and the following disclaimer.
 10 * * Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer
 12 * in the documentation and/or other materials provided with the
 13 * distribution.
 14 * * Neither the name of Google Inc. nor the names of its
 15 * contributors may be used to endorse or promote products derived from
 16 * this software without specific prior written permission.
 17 *
 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 29 */
 30
 31#ifndef UUID_h
 32#define UUID_h
 33
 34#include "PlatformString.h"
 35
 36namespace WebCore {
 37
 38// Creates a UUID that consists of 32 hexadecimal digits and returns its canonical form.
 39// The canonical form is displayed in 5 groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters.
 40// The hexadecimal values "a" through "f" are output as lower case characters.
 41String createCanonicalUUIDString();
 42
 43}
 44
 45#endif