Skip to content

Commit 0b08054

Browse files
committed
[chromium] Move WebMimeRegistry and dependencies to Source/Platform
https://bugs.webkit.org/show_bug.cgi?id=74583 Reviewed by Darin Fisher. .: Update .gitignore for Source/Platform/Platform.gyp/ generated project files. * .gitignore: Source/Platform: This creates a skeleton directory structure for the chromium WebKit platform API and moves WebMimeRegistry.h along with its dependencies (WebString and WebCString) to their final location. * Platform.gyp/Platform.gyp: Added. * Platform.gypi: Added. * chromium/platform/WebCString.h: Copied from Source/WebKit/chromium/public/platform/WebCString.h. (WebKit::WebCString::~WebCString): (WebKit::WebCString::WebCString): (WebKit::WebCString::operator=): (WebKit::WebCString::isEmpty): (WebKit::WebCString::isNull): (WebKit::WebCString::operator std::string): (WebKit::WebCString::fromUTF16): (WebKit::operator<): * chromium/platform/WebCommon.h: Copied from Source/WebKit/chromium/public/platform/WebCommon.h. * chromium/platform/WebMimeRegistry.h: Copied from Source/WebKit/chromium/public/platform/WebMimeRegistry.h. (WebKit::WebMimeRegistry::~WebMimeRegistry): * chromium/platform/WebString.h: Copied from Source/WebKit/chromium/public/platform/WebString.h. (WebKit::WebString::~WebString): (WebKit::WebString::WebString): (WebKit::WebString::operator=): (WebKit::WebString::isEmpty): (WebKit::WebString::isNull): (WebKit::WebString::operator string16): (WebKit::WebString::operator NullableString16): (WebKit::WebString::fromUTF8): (WebKit::operator==): (WebKit::operator!=): * chromium/src/WebCString.cpp: Renamed from Source/WebKit/chromium/src/WebCString.cpp. (WebKit::WebCString::compare): (WebKit::WebCString::reset): (WebKit::WebCString::assign): (WebKit::WebCString::length): (WebKit::WebCString::data): (WebKit::WebCString::utf16): (WebKit::WebCString::fromUTF16): (WebKit::WebCString::WebCString): (WebKit::WebCString::operator=): (WebKit::WebCString::operator WTF::CString): * chromium/src/WebString.cpp: Renamed from Source/WebKit/chromium/src/WebString.cpp. (WebKit::WebString::reset): (WebKit::WebString::assign): (WebKit::WebString::length): (WebKit::WebString::data): (WebKit::WebString::utf8): (WebKit::WebString::fromUTF8): (WebKit::WebString::equals): (WebKit::WebString::WebString): (WebKit::WebString::operator=): (WebKit::WebString::operator WTF::String): (WebKit::WebString::operator WTF::AtomicString): Source/WebKit/chromium: public/platform/WebMimeRegistry.h is a temporary forwarding header to ease the transition. Once downstream callers are updated to the new location this header can be removed. WebString, WebCString, and WebCommon.h will remain in place as forwarding headers for users of the WebKit client API. * WebKit.gyp: * public/platform/WebCString.h: * public/platform/WebCommon.h: * public/platform/WebMimeRegistry.h: * public/platform/WebString.h: Tools: Teaches the WEBKIT_EXPORT check about the chromium WebKit platform API header location. * Scripts/webkitpy/style/checkers/cpp.py: (check_function_definition): Canonical link: https://commits.webkit.org/92335@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@104048 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 23e0d10 commit 0b08054

19 files changed

Lines changed: 744 additions & 399 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ Source/WebKit/chromium/*.vcproj*
5454
Source/WebKit/chromium/All.xcodeproj
5555
Source/WebKit/chromium/WebKit.xcodeproj
5656
Source/WebKit/chromium/WebKitUnitTests.xcodeproj
57+
Source/Platform/Platform.gyp/*.Makefile
58+
Source/Platform/Platform.gyp/*.mk
59+
Source/Platform/Platform.gyp/*.sln
60+
Source/Platform/Platform.gyp/*.vcproj*
5761
Tools/Tools.xcodeproj
5862
Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.xcodeproj
5963

ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2012-01-04 James Robinson <jamesr@chromium.org>
2+
3+
[chromium] Move WebMimeRegistry and dependencies to Source/Platform
4+
https://bugs.webkit.org/show_bug.cgi?id=74583
5+
6+
Reviewed by Darin Fisher.
7+
8+
Update .gitignore for Source/Platform/Platform.gyp/ generated project files.
9+
10+
* .gitignore:
11+
112
2012-01-04 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
213

314
[Qt] Introduce new qmake variable 'WEBKIT' for signaling dependencies

Source/Platform/ChangeLog

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,62 @@
1+
2012-01-04 James Robinson <jamesr@chromium.org>
2+
3+
[chromium] Move WebMimeRegistry and dependencies to Source/Platform
4+
https://bugs.webkit.org/show_bug.cgi?id=74583
5+
6+
Reviewed by Darin Fisher.
7+
8+
This creates a skeleton directory structure for the chromium WebKit platform API and moves WebMimeRegistry.h
9+
along with its dependencies (WebString and WebCString) to their final location.
10+
11+
* Platform.gyp/Platform.gyp: Added.
12+
* Platform.gypi: Added.
13+
* chromium/platform/WebCString.h: Copied from Source/WebKit/chromium/public/platform/WebCString.h.
14+
(WebKit::WebCString::~WebCString):
15+
(WebKit::WebCString::WebCString):
16+
(WebKit::WebCString::operator=):
17+
(WebKit::WebCString::isEmpty):
18+
(WebKit::WebCString::isNull):
19+
(WebKit::WebCString::operator std::string):
20+
(WebKit::WebCString::fromUTF16):
21+
(WebKit::operator<):
22+
* chromium/platform/WebCommon.h: Copied from Source/WebKit/chromium/public/platform/WebCommon.h.
23+
* chromium/platform/WebMimeRegistry.h: Copied from Source/WebKit/chromium/public/platform/WebMimeRegistry.h.
24+
(WebKit::WebMimeRegistry::~WebMimeRegistry):
25+
* chromium/platform/WebString.h: Copied from Source/WebKit/chromium/public/platform/WebString.h.
26+
(WebKit::WebString::~WebString):
27+
(WebKit::WebString::WebString):
28+
(WebKit::WebString::operator=):
29+
(WebKit::WebString::isEmpty):
30+
(WebKit::WebString::isNull):
31+
(WebKit::WebString::operator string16):
32+
(WebKit::WebString::operator NullableString16):
33+
(WebKit::WebString::fromUTF8):
34+
(WebKit::operator==):
35+
(WebKit::operator!=):
36+
* chromium/src/WebCString.cpp: Renamed from Source/WebKit/chromium/src/WebCString.cpp.
37+
(WebKit::WebCString::compare):
38+
(WebKit::WebCString::reset):
39+
(WebKit::WebCString::assign):
40+
(WebKit::WebCString::length):
41+
(WebKit::WebCString::data):
42+
(WebKit::WebCString::utf16):
43+
(WebKit::WebCString::fromUTF16):
44+
(WebKit::WebCString::WebCString):
45+
(WebKit::WebCString::operator=):
46+
(WebKit::WebCString::operator WTF::CString):
47+
* chromium/src/WebString.cpp: Renamed from Source/WebKit/chromium/src/WebString.cpp.
48+
(WebKit::WebString::reset):
49+
(WebKit::WebString::assign):
50+
(WebKit::WebString::length):
51+
(WebKit::WebString::data):
52+
(WebKit::WebString::utf8):
53+
(WebKit::WebString::fromUTF8):
54+
(WebKit::WebString::equals):
55+
(WebKit::WebString::WebString):
56+
(WebKit::WebString::operator=):
57+
(WebKit::WebString::operator WTF::String):
58+
(WebKit::WebString::operator WTF::AtomicString):
59+
160
2011-11-02 Adam Barth <abarth@webkit.org>
261

362
Add stubs for WTF and Platform
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#
2+
# Copyright (C) 2011 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+
{
32+
'includes': [
33+
'../Platform.gypi',
34+
],
35+
'targets': [
36+
{
37+
'target_name': 'platform',
38+
'type': 'static_library',
39+
'dependencies': [
40+
'../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
41+
'../../WTF/WTF.gyp/WTF.gyp:newwtf',
42+
],
43+
'include_dirs': [
44+
'../chromium',
45+
],
46+
'defines': [
47+
'WEBKIT_IMPLEMENTATION=1',
48+
],
49+
'sources': [
50+
'<@(platform_files)',
51+
],
52+
'direct_dependent_settings': {
53+
'include_dirs': [
54+
'../chromium',
55+
],
56+
},
57+
'conditions': [
58+
['inside_chromium_build==1', {
59+
'conditions': [
60+
['component=="shared_library"', {
61+
'defines': [
62+
'WEBKIT_DLL',
63+
],
64+
}],
65+
],
66+
}],
67+
]
68+
}
69+
]
70+
}
71+

Source/Platform/Platform.gypi

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# Copyright (C) 2011 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+
{
32+
'variables': {
33+
'platform_files': [
34+
'chromium/public/WebCString.h',
35+
'chromium/public/WebCommon.h',
36+
'chromium/public/WebString.h',
37+
'chromium/public/WebMimeRegistry.h',
38+
'chromium/src/WebCString.cpp',
39+
'chromium/src/WebString.cpp',
40+
]
41+
}
42+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/*
2+
* Copyright (C) 2009 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 WebCString_h
32+
#define WebCString_h
33+
34+
#include "WebCommon.h"
35+
36+
#if WEBKIT_IMPLEMENTATION
37+
#include <wtf/Forward.h>
38+
#else
39+
#include <string>
40+
#endif
41+
42+
namespace WTF {
43+
class CString;
44+
}
45+
46+
namespace WebKit {
47+
48+
class WebCStringPrivate;
49+
class WebString;
50+
51+
// A single-byte string container with unspecified encoding. It is
52+
// inexpensive to copy a WebCString object.
53+
//
54+
// WARNING: It is not safe to pass a WebCString across threads!!!
55+
//
56+
class WebCString {
57+
public:
58+
~WebCString() { reset(); }
59+
60+
WebCString() : m_private(0) { }
61+
62+
WebCString(const char* data, size_t len) : m_private(0)
63+
{
64+
assign(data, len);
65+
}
66+
67+
WebCString(const WebCString& s) : m_private(0) { assign(s); }
68+
69+
WebCString& operator=(const WebCString& s)
70+
{
71+
assign(s);
72+
return *this;
73+
}
74+
75+
// Returns 0 if both strings are equals, a value greater than zero if the
76+
// first character that does not match has a greater value in this string
77+
// than in |other|, or a value less than zero to indicate the opposite.
78+
WEBKIT_EXPORT int compare(const WebCString& other) const;
79+
80+
WEBKIT_EXPORT void reset();
81+
WEBKIT_EXPORT void assign(const WebCString&);
82+
WEBKIT_EXPORT void assign(const char* data, size_t len);
83+
84+
WEBKIT_EXPORT size_t length() const;
85+
WEBKIT_EXPORT const char* data() const;
86+
87+
bool isEmpty() const { return !length(); }
88+
bool isNull() const { return !m_private; }
89+
90+
WEBKIT_EXPORT WebString utf16() const;
91+
92+
#if WEBKIT_IMPLEMENTATION
93+
WebCString(const WTF::CString&);
94+
WebCString& operator=(const WTF::CString&);
95+
operator WTF::CString() const;
96+
#else
97+
WebCString(const std::string& s) : m_private(0)
98+
{
99+
assign(s.data(), s.length());
100+
}
101+
102+
WebCString& operator=(const std::string& s)
103+
{
104+
assign(s.data(), s.length());
105+
return *this;
106+
}
107+
108+
operator std::string() const
109+
{
110+
size_t len = length();
111+
return len ? std::string(data(), len) : std::string();
112+
}
113+
114+
template <class UTF16String>
115+
static WebCString fromUTF16(const UTF16String& s)
116+
{
117+
return fromUTF16(s.data(), s.length());
118+
}
119+
#endif
120+
121+
private:
122+
void assign(WebCStringPrivate*);
123+
WebCStringPrivate* m_private;
124+
};
125+
126+
inline bool operator<(const WebCString& a, const WebCString& b)
127+
{
128+
return a.compare(b) < 0;
129+
}
130+
131+
} // namespace WebKit
132+
133+
#endif

0 commit comments

Comments
 (0)