15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/*
25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2010 Google Inc. All rights reserved.
35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without
55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modification, are permitted provided that the following conditions
65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * are met:
75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 1.  Redistributions of source code must retain the above copyright
95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     notice, this list of conditions and the following disclaimer.
105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 2.  Redistributions in binary form must reproduce the above copyright
115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     notice, this list of conditions and the following disclaimer in the
125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     documentation and/or other materials provided with the distribution.
135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */
255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef IDBBindingUtilities_h
275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define IDBBindingUtilities_h
285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
29197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/ScriptState.h"
30197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/ScriptValue.h"
3153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "wtf/Forward.h"
32197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include <v8.h>
335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
34f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liunamespace blink {
35f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu
36a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)class IDBAny;
375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class IDBKey;
385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class IDBKeyPath;
39c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles)class IDBKeyRange;
405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class SerializedScriptValue;
41926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)class SharedBuffer;
427242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucciclass WebBlobInfo;
43926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
44a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)// Exposed for unit testing:
456f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdochbool injectV8KeyIntoV8Value(v8::Isolate*, v8::Handle<v8::Value> key, v8::Handle<v8::Value>, const IDBKeyPath&);
46a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)
47a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)// For use by Source/modules/indexeddb:
48d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)IDBKey* createIDBKeyFromScriptValueAndKeyPath(v8::Isolate*, const ScriptValue&, const IDBKeyPath&);
496f543c786fc42989f552b4daa774ca5ff32fa697Ben Murdochbool canInjectIDBKeyIntoScriptValue(v8::Isolate*, const ScriptValue&, const IDBKeyPath&);
50d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)ScriptValue idbAnyToScriptValue(ScriptState*, IDBAny*);
51d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)ScriptValue idbKeyToScriptValue(ScriptState*, IDBKey*);
52d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)IDBKey* scriptValueToIDBKey(v8::Isolate*, const ScriptValue&);
53d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)IDBKeyRange* scriptValueToIDBKeyRange(v8::Isolate*, const ScriptValue&);
54197021e6b966cfb06891637935ef33fff06433d1Ben MurdochScriptValue deserializeScriptValue(ScriptState*, SerializedScriptValue*, const Vector<blink::WebBlobInfo>*);
555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
56197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#if ENABLE(ASSERT)
57d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)void assertPrimaryKeyValidOrInjectable(ScriptState*, PassRefPtr<SharedBuffer>, const Vector<blink::WebBlobInfo>*, IDBKey*, const IDBKeyPath&);
58a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#endif
59a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)
60c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink
615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif // IDBBindingUtilities_h
63