Changeset 104048 in webkit


Ignore:
Timestamp:
Jan 4, 2012 11:08:02 AM (12 years ago)
Author:
jamesr@google.com
Message:

[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):

Location:
trunk
Files:
6 added
11 edited
4 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/.gitignore

    r102201 r104048  
    5555Source/WebKit/chromium/WebKit.xcodeproj
    5656Source/WebKit/chromium/WebKitUnitTests.xcodeproj
     57Source/Platform/Platform.gyp/*.Makefile
     58Source/Platform/Platform.gyp/*.mk
     59Source/Platform/Platform.gyp/*.sln
     60Source/Platform/Platform.gyp/*.vcproj*
    5761Tools/Tools.xcodeproj
    5862Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.xcodeproj
  • trunk/ChangeLog

    r104034 r104048  
     12012-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
    1122012-01-04  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    213
  • trunk/Source/Platform/ChangeLog

    r99227 r104048  
     12012-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
    1602011-11-02  Adam Barth  <abarth@webkit.org>
    261
  • trunk/Source/Platform/chromium/public/WebCString.h

    r104047 r104048  
    111111        return len ? std::string(data(), len) : std::string();
    112112    }
     113
     114    template <class UTF16String>
     115    static WebCString fromUTF16(const UTF16String& s)
     116    {
     117        return fromUTF16(s.data(), s.length());
     118    }
    113119#endif
    114120
  • trunk/Source/Platform/chromium/public/WebMimeRegistry.h

    r104047 r104048  
    3535
    3636namespace WebKit {
    37 
    3837class WebString;
    3938
     
    4241    enum SupportsType { IsNotSupported, IsSupported, MayBeSupported };
    4342
    44     virtual SupportsType supportsMIMEType(const WebString& mimeType) = 0;
    45     virtual SupportsType supportsImageMIMEType(const WebString& mimeType) = 0;
    46     virtual SupportsType supportsJavaScriptMIMEType(const WebString& mimeType) = 0;
    47     virtual SupportsType supportsMediaMIMEType(const WebString& mimeType,
    48                                                const WebString& codecs) = 0;
    49     virtual SupportsType supportsNonImageMIMEType(const WebString& mimeType) = 0;
     43    virtual SupportsType supportsMIMEType(const WebKit::WebString& mimeType) = 0;
     44    virtual SupportsType supportsImageMIMEType(const WebKit::WebString& mimeType) = 0;
     45    virtual SupportsType supportsJavaScriptMIMEType(const WebKit::WebString& mimeType) = 0;
     46    virtual SupportsType supportsMediaMIMEType(const WebKit::WebString& mimeType,
     47                                               const WebKit::WebString& codecs) = 0;
     48    virtual SupportsType supportsNonImageMIMEType(const WebKit::WebString& mimeType) = 0;
    5049
    51     virtual WebString mimeTypeForExtension(const WebString& fileExtension) = 0;
    52     virtual WebString wellKnownMimeTypeForExtension(const WebString& fileExtension) = 0;
    53     virtual WebString mimeTypeFromFile(const WebString& filePath) = 0;
    54     virtual WebString preferredExtensionForMIMEType(const WebString& mimeType) = 0;
     50    virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString& fileExtension) = 0;
     51    virtual WebKit::WebString wellKnownMimeTypeForExtension(const WebKit::WebString& fileExtension) = 0;
     52    virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString& filePath) = 0;
     53    virtual WebKit::WebString preferredExtensionForMIMEType(const WebKit::WebString& mimeType) = 0;
    5554
    5655protected:
  • trunk/Source/Platform/chromium/src/WebCString.cpp

    • Property svn:eol-style changed from native to LF
    r104047 r104048  
    3030
    3131#include "config.h"
    32 #include "platform/WebCString.h"
     32#include <public/WebCString.h>
    3333
    34 #include "platform/WebString.h"
     34#include <public/WebString.h>
    3535#include <wtf/text/CString.h>
    3636
  • trunk/Source/Platform/chromium/src/WebString.cpp

    • Property svn:eol-style changed from native to LF
    r104047 r104048  
    3030
    3131#include "config.h"
    32 #include "platform/WebString.h"
     32#include <public/WebString.h>
    3333
    34 #include "PlatformString.h"
    35 #include "platform/WebCString.h"
     34#include <public/WebCString.h>
    3635#include <wtf/text/AtomicString.h>
    3736#include <wtf/text/CString.h>
     37#include <wtf/text/WTFString.h>
    3838
    3939namespace WebKit {
  • trunk/Source/WebKit/chromium/ChangeLog

    r104044 r104048  
     12012-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        public/platform/WebMimeRegistry.h is a temporary forwarding header to ease the transition. Once downstream
     9        callers are updated to the new location this header can be removed.
     10
     11        WebString, WebCString, and WebCommon.h will remain in place as forwarding headers for users of the WebKit client
     12        API.
     13
     14        * WebKit.gyp:
     15        * public/platform/WebCString.h:
     16        * public/platform/WebCommon.h:
     17        * public/platform/WebMimeRegistry.h:
     18        * public/platform/WebString.h:
     19
    1202012-01-03  Vangelis Kokkevis  <vangelis@chromium.org>
    221
  • trunk/Source/WebKit/chromium/WebKit.gyp

    r104033 r104048  
    6868            'dependencies': [
    6969                '../../WebCore/WebCore.gyp/WebCore.gyp:webcore',
     70                '../../Platform/Platform.gyp/Platform.gyp:platform', # actually WebCore should depend on this
    7071                '<(chromium_src_dir)/skia/skia.gyp:skia',
    7172                '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc',
     
    282283                'public/platform/WebBlobData.h',
    283284                'public/platform/WebBlobRegistry.h',
    284                 'public/platform/WebCString.h',
    285285                'public/platform/WebCanvas.h',
    286286                'public/platform/WebClipboard.h',
     
    495495                'src/WebContentLayerImpl.h',
    496496                'src/WebCrossOriginPreflightResultCache.cpp',
    497                 'src/WebCString.cpp',
    498497                'src/WebCursorInfo.cpp',
    499498                'src/WebDOMEvent.cpp',
     
    648647                'src/WebStorageQuotaCallbacksImpl.cpp',
    649648                'src/WebStorageQuotaCallbacksImpl.h',
    650                 'src/WebString.cpp',
    651649                'src/WebTextRun.cpp',
    652650                'src/WebThreadSafeData.cpp',
  • trunk/Source/WebKit/chromium/public/platform/WebCString.h

    r103124 r104048  
    2929 */
    3030
    31 #ifndef WebCString_h
    32 #define WebCString_h
     31#include "../../../../Platform/chromium/public/WebCString.h"
    3332
    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 #endif
    114 
    115 private:
    116     void assign(WebCStringPrivate*);
    117     WebCStringPrivate* m_private;
    118 };
    119 
    120 inline bool operator<(const WebCString& a, const WebCString& b)
    121 {
    122     return a.compare(b) < 0;
    123 }
    124 
    125 } // namespace WebKit
    126 
    127 #endif
  • trunk/Source/WebKit/chromium/public/platform/WebCommon.h

    r101122 r104048  
    2929 */
    3030
    31 #ifndef WebCommon_h
    32 #define WebCommon_h
    33 
    34 // -----------------------------------------------------------------------------
    35 // Default configuration
    36 
    37 #if !defined(WEBKIT_IMPLEMENTATION)
    38     #define WEBKIT_IMPLEMENTATION 0
    39 #endif
    40 
    41 #if !defined(WEBKIT_USING_SKIA)
    42     #if !defined(__APPLE__) || defined(USE_SKIA)
    43         #define WEBKIT_USING_SKIA 1
    44     #else
    45         #define WEBKIT_USING_SKIA 0
    46     #endif
    47 #endif
    48 
    49 #if !defined(WEBKIT_USING_CG)
    50     #if defined(__APPLE__) && !WEBKIT_USING_SKIA
    51         #define WEBKIT_USING_CG 1
    52     #else
    53         #define WEBKIT_USING_CG 0
    54     #endif
    55 #endif
    56 
    57 #if !defined(WEBKIT_USING_V8)
    58     #define WEBKIT_USING_V8 1
    59 #endif
    60 
    61 #if !defined(WEBKIT_USING_JSC)
    62     #define WEBKIT_USING_JSC 0
    63 #endif
    64 
    65 // -----------------------------------------------------------------------------
    66 // Exported symbols need to be annotated with WEBKIT_EXPORT
    67 
    68 #if defined(WEBKIT_DLL)
    69     #if defined(WIN32)
    70         #if WEBKIT_IMPLEMENTATION
    71             #define WEBKIT_EXPORT __declspec(dllexport)
    72         #else
    73             #define WEBKIT_EXPORT __declspec(dllimport)
    74         #endif
    75     #else
    76         #define WEBKIT_EXPORT __attribute__((visibility("default")))
    77     #endif
    78 #else
    79     #define WEBKIT_EXPORT
    80 #endif
    81 
    82 // -----------------------------------------------------------------------------
    83 // Basic types
    84 
    85 #include <stddef.h> // For size_t
    86 
    87 #if defined(WIN32)
    88 // Visual Studio doesn't have stdint.h.
    89 typedef short int16_t;
    90 typedef unsigned short uint16_t;
    91 typedef int int32_t;
    92 typedef unsigned int uint32_t;
    93 #endif
    94 
    95 namespace WebKit {
    96 
    97 // UTF-16 character type
    98 #if defined(WIN32)
    99 typedef wchar_t WebUChar;
    100 #else
    101 typedef unsigned short WebUChar;
    102 #endif
    103 
    104 // -----------------------------------------------------------------------------
    105 // Assertions
    106 
    107 WEBKIT_EXPORT void failedAssertion(const char* file, int line, const char* function, const char* assertion);
    108 
    109 } // namespace WebKit
    110 
    111 // Ideally, only use inside the public directory but outside of WEBKIT_IMPLEMENTATION blocks.  (Otherwise use WTF's ASSERT.)
    112 #if defined(NDEBUG)
    113 #define WEBKIT_ASSERT(assertion) ((void)0)
    114 #else
    115 #define WEBKIT_ASSERT(assertion) do { \
    116     if (!(assertion)) \
    117         failedAssertion(__FILE__, __LINE__, __FUNCTION__, #assertion); \
    118 } while (0)
    119 #endif
    120 
    121 #define WEBKIT_ASSERT_NOT_REACHED() WEBKIT_ASSERT(0)
    122 
    123 #endif
     31#include "../../../../Platform/chromium/public/WebCommon.h"
  • trunk/Source/WebKit/chromium/public/platform/WebMimeRegistry.h

    r101224 r104048  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions are
    6  * met:
     5 * modification, are permitted provided that the following conditions
     6 * are met:
    77 *
    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.
     8 * 1.  Redistributions of source code must retain the above copyright
     9 *     notice, this list of conditions and the following disclaimer.
     10 * 2.  Redistributions in binary form must reproduce the above copyright
     11 *     notice, this list of conditions and the following disclaimer in the
     12 *     documentation and/or other materials provided with the distribution.
    1713 *
    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.
     14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
     15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2924 */
    3025
    31 #ifndef WebMimeRegistry_h
    32 #define WebMimeRegistry_h
    33 
    34 #include "WebCommon.h"
    35 
    36 namespace WebKit {
    37 
    38 class WebString;
    39 
    40 class WebMimeRegistry {
    41 public:
    42     enum SupportsType { IsNotSupported, IsSupported, MayBeSupported };
    43 
    44     virtual SupportsType supportsMIMEType(const WebString& mimeType) = 0;
    45     virtual SupportsType supportsImageMIMEType(const WebString& mimeType) = 0;
    46     virtual SupportsType supportsJavaScriptMIMEType(const WebString& mimeType) = 0;
    47     virtual SupportsType supportsMediaMIMEType(const WebString& mimeType,
    48                                                const WebString& codecs) = 0;
    49     virtual SupportsType supportsNonImageMIMEType(const WebString& mimeType) = 0;
    50 
    51     virtual WebString mimeTypeForExtension(const WebString& fileExtension) = 0;
    52     virtual WebString wellKnownMimeTypeForExtension(const WebString& fileExtension) = 0;
    53     virtual WebString mimeTypeFromFile(const WebString& filePath) = 0;
    54     virtual WebString preferredExtensionForMIMEType(const WebString& mimeType) = 0;
    55 
    56 protected:
    57     ~WebMimeRegistry() { }
    58 };
    59 
    60 } // namespace WebKit
    61 
    62 #endif
     26// This is a temporary forwarding header to ease the Platform transition for downstream users of the WebKit API.
     27// See https://bugs.webkit.org/show_bug.cgi?id=74583
     28// FIXME: Remove as soon as downstream clients are updated.
     29#include "../../../../Platform/chromium/public/WebMimeRegistry.h"
  • trunk/Source/WebKit/chromium/public/platform/WebString.h

    r101122 r104048  
    2929 */
    3030
    31 #ifndef WebString_h
    32 #define WebString_h
     31#include "../../../../Platform/chromium/public/WebString.h"
    3332
    34 #include "WebCommon.h"
    35 
    36 #if WEBKIT_IMPLEMENTATION
    37 #include <wtf/Forward.h>
    38 #else
    39 #include <base/nullable_string16.h>
    40 #include <base/string16.h>
    41 #endif
    42 
    43 namespace WebKit {
    44 
    45 class WebCString;
    46 class WebStringPrivate;
    47 
    48 // A UTF-16 string container.  It is inexpensive to copy a WebString
    49 // object.
    50 //
    51 // WARNING: It is not safe to pass a WebString across threads!!!
    52 //
    53 class WebString {
    54 public:
    55     ~WebString() { reset(); }
    56 
    57     WebString() : m_private(0) { }
    58 
    59     WebString(const WebUChar* data, size_t len) : m_private(0)
    60     {
    61         assign(data, len);
    62     }
    63 
    64     WebString(const WebString& s) : m_private(0) { assign(s); }
    65 
    66     WebString& operator=(const WebString& s)
    67     {
    68         assign(s);
    69         return *this;
    70     }
    71 
    72     WEBKIT_EXPORT void reset();
    73     WEBKIT_EXPORT void assign(const WebString&);
    74     WEBKIT_EXPORT void assign(const WebUChar* data, size_t len);
    75 
    76     WEBKIT_EXPORT bool equals(const WebString& s) const;
    77 
    78     WEBKIT_EXPORT size_t length() const;
    79     WEBKIT_EXPORT const WebUChar* data() const;
    80 
    81     bool isEmpty() const { return !length(); }
    82     bool isNull() const { return !m_private; }
    83 
    84     WEBKIT_EXPORT WebCString utf8() const;
    85 
    86     WEBKIT_EXPORT static WebString fromUTF8(const char* data, size_t length);
    87     WEBKIT_EXPORT static WebString fromUTF8(const char* data);
    88 
    89     template <int N> WebString(const char (&data)[N])
    90         : m_private(0)
    91     {
    92         assign(fromUTF8(data, N - 1));
    93     }
    94 
    95     template <int N> WebString& operator=(const char (&data)[N])
    96     {
    97         assign(fromUTF8(data, N - 1));
    98         return *this;
    99     }
    100 
    101 #if WEBKIT_IMPLEMENTATION
    102     WebString(const WTF::String&);
    103     WebString& operator=(const WTF::String&);
    104     operator WTF::String() const;
    105 
    106     WebString(const WTF::AtomicString&);
    107     WebString& operator=(const WTF::AtomicString&);
    108     operator WTF::AtomicString() const;
    109 #else
    110 
    111     WebString(const string16& s) : m_private(0)
    112     {
    113         assign(s.data(), s.length());
    114     }
    115 
    116     WebString& operator=(const string16& s)
    117     {
    118         assign(s.data(), s.length());
    119         return *this;
    120     }
    121 
    122     operator string16() const
    123     {
    124         size_t len = length();
    125         return len ? string16(data(), len) : string16();
    126     }
    127 
    128     WebString(const NullableString16& s) : m_private(0)
    129     {
    130         if (s.is_null())
    131             reset();
    132         else
    133             assign(s.string().data(), s.string().length());
    134     }
    135 
    136     WebString& operator=(const NullableString16& s)
    137     {
    138         if (s.is_null())
    139             reset();
    140         else
    141             assign(s.string().data(), s.string().length());
    142         return *this;
    143     }
    144 
    145     operator NullableString16() const
    146     {
    147         if (!m_private)
    148             return NullableString16(string16(), true);
    149         size_t len = length();
    150         return NullableString16(len ? string16(data(), len) : string16(), false);
    151     }
    152 
    153     template <class UTF8String>
    154     static WebString fromUTF8(const UTF8String& s)
    155     {
    156         return fromUTF8(s.data(), s.length());
    157     }
    158 #endif
    159 
    160 private:
    161     void assign(WebStringPrivate*);
    162     WebStringPrivate* m_private;
    163 };
    164 
    165 inline bool operator==(const WebString& a, const WebString& b)
    166 {
    167     return a.equals(b);
    168 }
    169 
    170 inline bool operator!=(const WebString& a, const WebString& b)
    171 {
    172     return !(a == b);
    173 }
    174 
    175 } // namespace WebKit
    176 
    177 #endif
  • trunk/Tools/ChangeLog

    r104039 r104048  
     12012-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        Teaches the WEBKIT_EXPORT check about the chromium WebKit platform API header location.
     9
     10        * Scripts/webkitpy/style/checkers/cpp.py:
     11        (check_function_definition):
     12
    1132012-01-04  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    214
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

    r100678 r104048  
    16031603    modifiers_and_return_type = function_state.modifiers_and_return_type()
    16041604    if filename.find('/chromium/') != -1 and search(r'\bWEBKIT_EXPORT\b', modifiers_and_return_type):
    1605         if filename.find('/chromium/public/') == -1 and filename.find('/chromium/tests/') == -1:
     1605        if filename.find('/chromium/public/') == -1 and filename.find('/chromium/tests/') == -1 and filename.find('chromium/platform') == -1:
    16061606            error(function_state.function_name_start_position.row, 'readability/webkit_export', 5,
    16071607                  'WEBKIT_EXPORT should only appear in the chromium public (or tests) directory.')
Note: See TracChangeset for help on using the changeset viewer.