Home | History | Annotate | Download | only in platform
      1 /*
      2  * Copyright (C) 2012 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 Platform_h
     32 #define Platform_h
     33 
     34 #ifdef WIN32
     35 #include <windows.h>
     36 #endif
     37 
     38 #include "WebAudioDevice.h"
     39 #include "WebCommon.h"
     40 #include "WebData.h"
     41 #include "WebGamepads.h"
     42 #include "WebGraphicsContext3D.h"
     43 #include "WebLocalizedString.h"
     44 #include "WebSpeechSynthesizer.h"
     45 #include "WebStorageQuotaType.h"
     46 #include "WebString.h"
     47 #include "WebURLError.h"
     48 #include "WebVector.h"
     49 
     50 class GrContext;
     51 
     52 namespace WebKit {
     53 
     54 class WebAudioBus;
     55 class WebBlobRegistry;
     56 class WebContentDecryptionModule;
     57 class WebClipboard;
     58 class WebCompositorSupport;
     59 class WebCookieJar;
     60 class WebCrypto;
     61 class WebDeviceMotionListener;
     62 class WebDeviceOrientationListener;
     63 class WebDiscardableMemory;
     64 class WebFallbackThemeEngine;
     65 class WebFileSystem;
     66 class WebFileUtilities;
     67 class WebFlingAnimator;
     68 class WebGestureCurveTarget;
     69 class WebGestureCurve;
     70 class WebGraphicsContext3DProvider;
     71 class WebIDBFactory;
     72 class WebMIDIAccessor;
     73 class WebMIDIAccessorClient;
     74 class WebMediaStreamCenter;
     75 class WebMediaStreamCenterClient;
     76 class WebMessagePortChannel;
     77 class WebMimeRegistry;
     78 class WebPluginListBuilder;
     79 class WebPrescientNetworking;
     80 class WebRTCPeerConnectionHandler;
     81 class WebRTCPeerConnectionHandlerClient;
     82 class WebSandboxSupport;
     83 class WebSocketStreamHandle;
     84 class WebSpeechSynthesizer;
     85 class WebSpeechSynthesizerClient;
     86 class WebStorageNamespace;
     87 class WebStorageQuotaCallbacks;
     88 class WebUnitTestSupport;
     89 class WebThemeEngine;
     90 class WebThread;
     91 class WebURL;
     92 class WebURLLoader;
     93 class WebWorkerRunLoop;
     94 struct WebFloatPoint;
     95 struct WebLocalizedString;
     96 struct WebSize;
     97 
     98 class Platform {
     99 public:
    100     // HTML5 Database ------------------------------------------------------
    101 
    102 #ifdef WIN32
    103     typedef HANDLE FileHandle;
    104 #else
    105     typedef int FileHandle;
    106 #endif
    107 
    108     WEBKIT_EXPORT static void initialize(Platform*);
    109     WEBKIT_EXPORT static void shutdown();
    110     WEBKIT_EXPORT static Platform* current();
    111 
    112     // May return null.
    113     virtual WebCookieJar* cookieJar() { return 0; }
    114 
    115     // Must return non-null.
    116     virtual WebClipboard* clipboard() { return 0; }
    117 
    118     // Must return non-null.
    119     virtual WebFileUtilities* fileUtilities() { return 0; }
    120 
    121     // Must return non-null.
    122     virtual WebMimeRegistry* mimeRegistry() { return 0; }
    123 
    124     // May return null if sandbox support is not necessary
    125     virtual WebSandboxSupport* sandboxSupport() { return 0; }
    126 
    127     // May return null on some platforms.
    128     virtual WebThemeEngine* themeEngine() { return 0; }
    129 
    130     virtual WebFallbackThemeEngine* fallbackThemeEngine() { return 0; }
    131 
    132     // May return null.
    133     virtual WebSpeechSynthesizer* createSpeechSynthesizer(WebSpeechSynthesizerClient*) { return 0; }
    134 
    135 
    136     // Media --------------------------------------------------------------
    137 
    138     // May return null.
    139     virtual WebContentDecryptionModule* createContentDecryptionModule(const WebString& keySystem) { return 0; }
    140 
    141 
    142     // Audio --------------------------------------------------------------
    143 
    144     virtual double audioHardwareSampleRate() { return 0; }
    145     virtual size_t audioHardwareBufferSize() { return 0; }
    146     virtual unsigned audioHardwareOutputChannels() { return 0; }
    147 
    148     // Creates a device for audio I/O.
    149     // Pass in (numberOfInputChannels > 0) if live/local audio input is desired.
    150     virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfChannels, double sampleRate, WebAudioDevice::RenderCallback*, const WebString& deviceId) { return 0; }
    151 
    152     // FIXME: remove deprecated APIs once chromium switches over to new method.
    153     virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned numberOfChannels, double sampleRate, WebAudioDevice::RenderCallback*) { return 0; }
    154     virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfChannels, double sampleRate, WebAudioDevice::RenderCallback*) { return 0; }
    155 
    156 
    157     // MIDI ----------------------------------------------------------------
    158 
    159     // Creates a platform dependent WebMIDIAccessor. MIDIAccessor under platform
    160     // creates and owns it.
    161     virtual WebMIDIAccessor* createMIDIAccessor(WebMIDIAccessorClient*) { return 0; }
    162 
    163 
    164     // Blob ----------------------------------------------------------------
    165 
    166     // Must return non-null.
    167     virtual WebBlobRegistry* blobRegistry() { return 0; }
    168 
    169 
    170     // Database ------------------------------------------------------------
    171 
    172     // Opens a database file; dirHandle should be 0 if the caller does not need
    173     // a handle to the directory containing this file
    174     virtual FileHandle databaseOpenFile(const WebString& vfsFileName, int desiredFlags) { return FileHandle(); }
    175 
    176     // Deletes a database file and returns the error code
    177     virtual int databaseDeleteFile(const WebString& vfsFileName, bool syncDir) { return 0; }
    178 
    179     // Returns the attributes of the given database file
    180     virtual long databaseGetFileAttributes(const WebString& vfsFileName) { return 0; }
    181 
    182     // Returns the size of the given database file
    183     virtual long long databaseGetFileSize(const WebString& vfsFileName) { return 0; }
    184 
    185     // Returns the space available for the given origin
    186     virtual long long databaseGetSpaceAvailableForOrigin(const WebKit::WebString& originIdentifier) { return 0; }
    187 
    188 
    189     // DOM Storage --------------------------------------------------
    190 
    191     // Return a LocalStorage namespace
    192     virtual WebStorageNamespace* createLocalStorageNamespace() { return 0; }
    193 
    194 
    195     // FileSystem ----------------------------------------------------------
    196 
    197     // Must return non-null.
    198     virtual WebFileSystem* fileSystem() { return 0; }
    199 
    200 
    201     // IDN conversion ------------------------------------------------------
    202 
    203     virtual WebString convertIDNToUnicode(const WebString& host, const WebString& languages) { return host; }
    204 
    205 
    206     // IndexedDB ----------------------------------------------------------
    207 
    208     // Must return non-null.
    209     virtual WebIDBFactory* idbFactory() { return 0; }
    210 
    211 
    212     // Gamepad -------------------------------------------------------------
    213 
    214     virtual void sampleGamepads(WebGamepads& into) { into.length = 0; }
    215 
    216 
    217     // History -------------------------------------------------------------
    218 
    219     // Returns the hash for the given canonicalized URL for use in visited
    220     // link coloring.
    221     virtual unsigned long long visitedLinkHash(
    222         const char* canonicalURL, size_t length) { return 0; }
    223 
    224     // Returns whether the given link hash is in the user's history. The
    225     // hash must have been generated by calling VisitedLinkHash().
    226     virtual bool isLinkVisited(unsigned long long linkHash) { return false; }
    227 
    228 
    229     // Keygen --------------------------------------------------------------
    230 
    231     // Handle the <keygen> tag for generating client certificates
    232     // Returns a base64 encoded signed copy of a public key from a newly
    233     // generated key pair and the supplied challenge string. keySizeindex
    234     // specifies the strength of the key.
    235     virtual WebString signedPublicKeyAndChallengeString(unsigned keySizeIndex,
    236                                                         const WebString& challenge,
    237                                                         const WebURL& url) { return WebString(); }
    238 
    239 
    240     // Memory --------------------------------------------------------------
    241 
    242     // Returns the current space allocated for the pagefile, in MB.
    243     // That is committed size for Windows and virtual memory size for POSIX
    244     virtual size_t memoryUsageMB() { return 0; }
    245 
    246     // Same as above, but always returns actual value, without any caches.
    247     virtual size_t actualMemoryUsageMB() { return 0; }
    248 
    249     // Returns private and shared usage, in bytes. Private bytes is the amount of
    250     // memory currently allocated to this process that cannot be shared. Returns
    251     // false on platform specific error conditions.
    252     virtual bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes) { return false; }
    253 
    254     // A callback interface for requestProcessMemorySizes
    255     class ProcessMemorySizesCallback {
    256     public:
    257         virtual ~ProcessMemorySizesCallback() { }
    258         virtual void dataReceived(size_t privateBytes, size_t sharedBytes) = 0;
    259     };
    260 
    261     // Requests private and shared usage, in bytes. Private bytes is the amount of
    262     // memory currently allocated to this process that cannot be shared.
    263     // The callback ownership is passed to the callee.
    264     virtual void requestProcessMemorySizes(ProcessMemorySizesCallback* requestCallback) { }
    265 
    266     // Reports number of bytes used by memory allocator for internal needs.
    267     // Returns true if the size has been reported, or false otherwise.
    268     virtual bool memoryAllocatorWasteInBytes(size_t*) { return false; }
    269 
    270     // Allocates discardable memory. May return 0, even if the platform supports
    271     // discardable memory. If nonzero, however, then the WebDiscardableMmeory is
    272     // returned in an locked state. You may use its underlying data() member
    273     // directly, taking care to unlock it when you are ready to let it become
    274     // discardable.
    275     virtual WebDiscardableMemory* allocateAndLockDiscardableMemory(size_t bytes) { return 0; }
    276 
    277     // A wrapper for tcmalloc's HeapProfilerStart();
    278     virtual void startHeapProfiling(const WebString& /*prefix*/) { }
    279     // A wrapper for tcmalloc's HeapProfilerStop();
    280     virtual void stopHeapProfiling() { }
    281     // A wrapper for tcmalloc's HeapProfilerDump()
    282     virtual void dumpHeapProfiling(const WebString& /*reason*/) { }
    283     // A wrapper for tcmalloc's GetHeapProfile()
    284     virtual WebString getHeapProfile() { return WebString(); }
    285 
    286 
    287     // Message Ports -------------------------------------------------------
    288 
    289     // Creates a Message Port Channel. This can be called on any thread.
    290     // The returned object should only be used on the thread it was created on.
    291     virtual WebMessagePortChannel* createMessagePortChannel() { return 0; }
    292 
    293 
    294     // Network -------------------------------------------------------------
    295 
    296     // Returns a new WebURLLoader instance.
    297     virtual WebURLLoader* createURLLoader() { return 0; }
    298 
    299     // May return null.
    300     virtual WebPrescientNetworking* prescientNetworking() { return 0; }
    301 
    302     // Returns a new WebSocketStreamHandle instance.
    303     virtual WebSocketStreamHandle* createSocketStreamHandle() { return 0; }
    304 
    305     // Returns the User-Agent string that should be used for the given URL.
    306     virtual WebString userAgent(const WebURL&) { return WebString(); }
    307 
    308     // A suggestion to cache this metadata in association with this URL.
    309     virtual void cacheMetadata(const WebURL&, double responseTime, const char* data, size_t dataSize) { }
    310 
    311     // Returns the decoded data url if url had a supported mimetype and parsing was successful.
    312     virtual WebData parseDataURL(const WebURL&, WebString& mimetype, WebString& charset) { return WebData(); }
    313 
    314     virtual WebURLError cancelledError(const WebURL&) const { return WebURLError(); }
    315 
    316 
    317     // Plugins -------------------------------------------------------------
    318 
    319     // If refresh is true, then cached information should not be used to
    320     // satisfy this call.
    321     virtual void getPluginList(bool refresh, WebPluginListBuilder*) { }
    322 
    323 
    324     // Resources -----------------------------------------------------------
    325 
    326     // Returns a localized string resource (with substitution parameters).
    327     virtual WebString queryLocalizedString(WebLocalizedString::Name) { return WebString(); }
    328     virtual WebString queryLocalizedString(WebLocalizedString::Name, const WebString& parameter) { return WebString(); }
    329     virtual WebString queryLocalizedString(WebLocalizedString::Name, const WebString& parameter1, const WebString& parameter2) { return WebString(); }
    330 
    331 
    332     // Threads -------------------------------------------------------
    333 
    334     // Creates an embedder-defined thread.
    335     virtual WebThread* createThread(const char* name) { return 0; }
    336 
    337     // Returns an interface to the current thread. This is owned by the
    338     // embedder.
    339     virtual WebThread* currentThread() { return 0; }
    340 
    341 
    342     // Profiling -----------------------------------------------------------
    343 
    344     virtual void decrementStatsCounter(const char* name) { }
    345     virtual void incrementStatsCounter(const char* name) { }
    346 
    347 
    348     // Resources -----------------------------------------------------------
    349 
    350     // Returns a blob of data corresponding to the named resource.
    351     virtual WebData loadResource(const char* name) { return WebData(); }
    352 
    353     // Decodes the in-memory audio file data and returns the linear PCM audio data in the destinationBus.
    354     // A sample-rate conversion to sampleRate will occur if the file data is at a different sample-rate.
    355     // Returns true on success.
    356     virtual bool loadAudioResource(WebAudioBus* destinationBus, const char* audioFileData, size_t dataSize, double sampleRate) { return false; }
    357 
    358 
    359     // Screen -------------------------------------------------------------
    360 
    361     // Supplies the system monitor color profile.
    362     virtual void screenColorProfile(WebVector<char>* profile) { }
    363 
    364 
    365     // Sudden Termination --------------------------------------------------
    366 
    367     // Disable/Enable sudden termination.
    368     virtual void suddenTerminationChanged(bool enabled) { }
    369 
    370 
    371     // System --------------------------------------------------------------
    372 
    373     // Returns a value such as "en-US".
    374     virtual WebString defaultLocale() { return WebString(); }
    375 
    376     // Wall clock time in seconds since the epoch.
    377     virtual double currentTime() { return 0; }
    378 
    379     // Monotonically increasing time in seconds from an arbitrary fixed point in the past.
    380     // This function is expected to return at least millisecond-precision values. For this reason,
    381     // it is recommended that the fixed point be no further in the past than the epoch.
    382     virtual double monotonicallyIncreasingTime() { return 0; }
    383 
    384     // WebKit clients must implement this funcion if they use cryptographic randomness.
    385     virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) = 0;
    386 
    387     // Delayed work is driven by a shared timer.
    388     typedef void (*SharedTimerFunction)();
    389     virtual void setSharedTimerFiredFunction(SharedTimerFunction timerFunction) { }
    390     virtual void setSharedTimerFireInterval(double) { }
    391     virtual void stopSharedTimer() { }
    392 
    393     // Callable from a background WebKit thread.
    394     virtual void callOnMainThread(void (*func)(void*), void* context) { }
    395 
    396 
    397     // Vibration -----------------------------------------------------------
    398 
    399     // Starts a vibration for the given duration in milliseconds. If there is currently an active
    400     // vibration it will be cancelled before the new one is started.
    401     virtual void vibrate(unsigned time) { }
    402 
    403     // Cancels the current vibration, if there is one.
    404     virtual void cancelVibration() { }
    405 
    406 
    407     // Testing -------------------------------------------------------------
    408 
    409 #define HAVE_WEBUNITTESTSUPPORT 1
    410     // Get a pointer to testing support interfaces. Will not be available in production builds.
    411     virtual WebUnitTestSupport* unitTestSupport() { return 0; }
    412 
    413 
    414     // Tracing -------------------------------------------------------------
    415 
    416     // Get a pointer to the enabled state of the given trace category. The
    417     // embedder can dynamically change the enabled state as trace event
    418     // recording is started and stopped by the application. Only long-lived
    419     // literal strings should be given as the category name. The implementation
    420     // expects the returned pointer to be held permanently in a local static. If
    421     // the unsigned char is non-zero, tracing is enabled. If tracing is enabled,
    422     // addTraceEvent is expected to be called by the trace event macros.
    423     virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) { return 0; }
    424 
    425     typedef long int TraceEventAPIAtomicWord;
    426 
    427     // Get a pointer to a global state of the given thread. An embedder is
    428     // expected to update the global state as the state of the embedder changes.
    429     // A sampling thread in the Chromium side reads the global state periodically
    430     // and reflects the sampling profiled results into about:tracing.
    431     virtual TraceEventAPIAtomicWord* getTraceSamplingState(const unsigned bucketName) { return 0; }
    432 
    433     // Add a trace event to the platform tracing system. Depending on the actual
    434     // enabled state, this event may be recorded or dropped.
    435     // - phase specifies the type of event:
    436     //   - BEGIN ('B'): Marks the beginning of a scoped event.
    437     //   - END ('E'): Marks the end of a scoped event.
    438     //   - INSTANT ('I'): Standalone, instantaneous event.
    439     //   - START ('S'): Marks the beginning of an asynchronous event (the end
    440     //     event can occur in a different scope or thread). The id parameter is
    441     //     used to match START/FINISH pairs.
    442     //   - FINISH ('F'): Marks the end of an asynchronous event.
    443     //   - COUNTER ('C'): Used to trace integer quantities that change over
    444     //     time. The argument values are expected to be of type int.
    445     //   - METADATA ('M'): Reserved for internal use.
    446     // - categoryEnabled is the pointer returned by getTraceCategoryEnabledFlag.
    447     // - name is the name of the event. Also used to match BEGIN/END and
    448     //   START/FINISH pairs.
    449     // - id optionally allows events of the same name to be distinguished from
    450     //   each other. For example, to trace the consutruction and destruction of
    451     //   objects, specify the pointer as the id parameter.
    452     // - numArgs specifies the number of elements in argNames, argTypes, and
    453     //   argValues.
    454     // - argNames is the array of argument names. Use long-lived literal strings
    455     //   or specify the COPY flag.
    456     // - argTypes is the array of argument types:
    457     //   - BOOL (1): bool
    458     //   - UINT (2): unsigned long long
    459     //   - INT (3): long long
    460     //   - DOUBLE (4): double
    461     //   - POINTER (5): void*
    462     //   - STRING (6): char* (long-lived null-terminated char* string)
    463     //   - COPY_STRING (7): char* (temporary null-terminated char* string)
    464     // - argValues is the array of argument values. Each value is the unsigned
    465     //   long long member of a union of all supported types.
    466     // - thresholdBeginId optionally specifies the value returned by a previous
    467     //   call to addTraceEvent with a BEGIN phase.
    468     // - threshold is used on an END phase event in conjunction with the
    469     //   thresholdBeginId of a prior BEGIN event. The threshold is the minimum
    470     //   number of microseconds that must have passed since the BEGIN event. If
    471     //   less than threshold microseconds has passed, the BEGIN/END pair is
    472     //   dropped.
    473     // - flags can be 0 or one or more of the following, ORed together:
    474     //   - COPY (0x1): treat all strings (name, argNames and argValues of type
    475     //     string) as temporary so that they will be copied by addTraceEvent.
    476     //   - HAS_ID (0x2): use the id argument to uniquely identify the event for
    477     //     matching with other events of the same name.
    478     //   - MANGLE_ID (0x4): specify this flag if the id parameter is the value
    479     //     of a pointer.
    480     virtual void addTraceEvent(
    481         char phase,
    482         const unsigned char* categoryEnabledFlag,
    483         const char* name,
    484         unsigned long long id,
    485         int numArgs,
    486         const char** argNames,
    487         const unsigned char* argTypes,
    488         const unsigned long long* argValues,
    489         unsigned char flags) { }
    490 
    491     // Callbacks for reporting histogram data.
    492     // CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50 would do.
    493     virtual void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount) { }
    494     // Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample value.
    495     virtual void histogramEnumeration(const char* name, int sample, int boundaryValue) { }
    496     // Unlike enumeration histograms, sparse histograms only allocate memory for non-empty buckets.
    497     virtual void histogramSparse(const char* name, int sample) { }
    498 
    499 
    500     // GPU ----------------------------------------------------------------
    501     //
    502     // May return null if GPU is not supported.
    503     // Returns newly allocated and initialized offscreen WebGraphicsContext3D instance.
    504     virtual WebGraphicsContext3D* createOffscreenGraphicsContext3D(const WebGraphicsContext3D::Attributes&) { return 0; }
    505 
    506     // Returns a newly allocated and initialized offscreen context provider. The provider may return a null
    507     // graphics context if GPU is not supported.
    508     virtual WebGraphicsContext3DProvider* createSharedOffscreenGraphicsContext3DProvider() { return 0; }
    509 
    510     // Returns true if the platform is capable of producing an offscreen context suitable for accelerating 2d canvas.
    511     // This will return false if the platform cannot promise that contexts will be preserved across operations like
    512     // locking the screen or if the platform cannot provide a context with suitable performance characteristics.
    513     //
    514     // This value must be checked again after a context loss event as the platform's capabilities may have changed.
    515     virtual bool canAccelerate2dCanvas() { return false; }
    516 
    517     virtual bool isThreadedCompositingEnabled() { return false; }
    518 
    519     virtual WebCompositorSupport* compositorSupport() { return 0; }
    520 
    521     virtual WebFlingAnimator* createFlingAnimator() { return 0; }
    522 
    523     // Creates a new fling animation curve instance for device |deviceSource|
    524     // with |velocity| and already scrolled |cumulativeScroll| pixels.
    525     virtual WebGestureCurve* createFlingAnimationCurve(int deviceSource, const WebFloatPoint& velocity, const WebSize& cumulativeScroll) { return 0; }
    526 
    527 
    528     // WebRTC ----------------------------------------------------------
    529 
    530     // Creates an WebRTCPeerConnectionHandler for RTCPeerConnection.
    531     // May return null if WebRTC functionality is not avaliable or out of resources.
    532     virtual WebRTCPeerConnectionHandler* createRTCPeerConnectionHandler(WebRTCPeerConnectionHandlerClient*) { return 0; }
    533 
    534     // May return null if WebRTC functionality is not avaliable or out of resources.
    535     virtual WebMediaStreamCenter* createMediaStreamCenter(WebMediaStreamCenterClient*) { return 0; }
    536 
    537 
    538     // WebWorker ----------------------------------------------------------
    539 
    540     virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { }
    541     virtual void didStopWorkerRunLoop(const WebWorkerRunLoop&) { }
    542 
    543 
    544     // WebCrypto ----------------------------------------------------------
    545 
    546     // May return 0.
    547     virtual WebCrypto* crypto() { return 0; }
    548 
    549 
    550     // Device Motion / Orientation ----------------------------------------
    551 
    552     // Sets a Listener to listen for device motion data updates.
    553     // If null, the platform stops providing device motion data to the current listener.
    554     virtual void setDeviceMotionListener(WebKit::WebDeviceMotionListener*) { }
    555 
    556     // Sets a Listener to listen for device orientation data updates.
    557     // If null, the platform stops proving device orientation data to the current listener.
    558     virtual void setDeviceOrientationListener(WebKit::WebDeviceOrientationListener*) { }
    559 
    560 
    561     // Quota -----------------------------------------------------------
    562 
    563     // Queries the storage partition's storage usage and quota information.
    564     // WebStorageQuotaCallbacks::didQueryStorageUsageAndQuota will be called
    565     // with the current usage and quota information for the partition. When
    566     // an error occurs WebStorageQuotaCallbacks::didFail is called with an
    567     // error code.
    568     // The callbacks object is deleted when the callback method is called
    569     // and does not need to be (and should not be) deleted manually.
    570     virtual void queryStorageUsageAndQuota(
    571         const WebURL& storagePartition,
    572         WebStorageQuotaType,
    573         WebStorageQuotaCallbacks*) { }
    574 
    575 protected:
    576     virtual ~Platform() { }
    577 };
    578 
    579 } // namespace WebKit
    580 
    581 #endif
    582