OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2013 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 "bindings/core/dart/DartScriptState.h" |
| 33 |
| 34 #include "bindings/common/AbstractScriptPromiseResolver.h" |
| 35 #include "bindings/core/dart/DartUtilities.h" |
| 36 #include "platform/SharedBuffer.h" |
| 37 #include <dart_tools_api.h> |
| 38 |
| 39 namespace blink { |
| 40 |
| 41 DartScriptState::DartScriptState(Dart_Isolate isolate, intptr_t libraryId, V8Scr
iptState* v8ScriptState, const String& isolateName) |
| 42 { |
| 43 m_isolate = isolate; |
| 44 m_libraryId = libraryId; |
| 45 String libraryUrl = DartUtilities::toString(Dart_GetLibraryURL(libraryId)); |
| 46 if (!isolateName.isEmpty()) { |
| 47 m_name = String::format("%s- %s", isolateName.utf8().data(), libraryUrl.
utf8().data()); |
| 48 } else { |
| 49 m_name = libraryUrl; |
| 50 } |
| 51 m_v8ScriptState = v8ScriptState; |
| 52 } |
| 53 |
| 54 bool DartScriptState::contextIsValid() const |
| 55 { |
| 56 if (m_v8ScriptState) |
| 57 return m_v8ScriptState->contextIsValid(); |
| 58 return true; |
| 59 } |
| 60 |
| 61 PassRefPtr<AbstractScriptValue> DartScriptState::createNull() |
| 62 { |
| 63 RELEASE_ASSERT_NOT_REACHED(); |
| 64 return reinterpret_cast<AbstractScriptValue*>(0); |
| 65 } |
| 66 |
| 67 PassRefPtr<AbstractScriptValue> DartScriptState::createUndefined() |
| 68 { |
| 69 RELEASE_ASSERT_NOT_REACHED(); |
| 70 return reinterpret_cast<AbstractScriptValue*>(0); |
| 71 } |
| 72 |
| 73 PassRefPtr<AbstractScriptValue> DartScriptState::createBoolean(bool value) |
| 74 { |
| 75 RELEASE_ASSERT_NOT_REACHED(); |
| 76 return reinterpret_cast<AbstractScriptValue*>(0); |
| 77 } |
| 78 |
| 79 PassRefPtr<AbstractScriptPromise> DartScriptState::createEmptyPromise() |
| 80 { |
| 81 RELEASE_ASSERT_NOT_REACHED(); |
| 82 return reinterpret_cast<AbstractScriptPromise*>(0); |
| 83 } |
| 84 |
| 85 PassRefPtr<AbstractScriptPromise> DartScriptState::createRejectedPromise(PassRef
PtrWillBeRawPtr<DOMException> domException) |
| 86 { |
| 87 RELEASE_ASSERT_NOT_REACHED(); |
| 88 return reinterpret_cast<AbstractScriptPromise*>(0); |
| 89 } |
| 90 |
| 91 PassRefPtr<AbstractScriptPromise> DartScriptState::createPromiseRejectedWithType
Error(const String& message) |
| 92 { |
| 93 RELEASE_ASSERT_NOT_REACHED(); |
| 94 return reinterpret_cast<AbstractScriptPromise*>(0); |
| 95 } |
| 96 |
| 97 PassOwnPtr<AbstractScriptPromiseResolver> DartScriptState::createPromiseResolver
(ScriptPromiseResolver* owner) |
| 98 { |
| 99 RELEASE_ASSERT_NOT_REACHED(); |
| 100 return PassOwnPtr<AbstractScriptPromiseResolver>(); |
| 101 } |
| 102 |
| 103 class DartScriptStateProtectingContext : public AbstractScriptStateProtectingCon
text { |
| 104 public: |
| 105 DartScriptStateProtectingContext(DartScriptState* scriptState) |
| 106 : m_scriptState(scriptState) |
| 107 { |
| 108 } |
| 109 |
| 110 DartScriptState* get() const { return m_scriptState.get(); } |
| 111 void clear() { m_scriptState.clear(); } |
| 112 |
| 113 private: |
| 114 RefPtr<DartScriptState> m_scriptState; |
| 115 }; |
| 116 |
| 117 AbstractScriptStateProtectingContext* DartScriptState::createProtectingContext() |
| 118 { |
| 119 RELEASE_ASSERT_NOT_REACHED(); |
| 120 return 0; |
| 121 } |
| 122 |
| 123 PassRefPtr<AbstractScriptValue> DartScriptState::idbAnyToScriptValue(IDBAny* any
) |
| 124 { |
| 125 RELEASE_ASSERT_NOT_REACHED(); |
| 126 return reinterpret_cast<AbstractScriptValue*>(0); |
| 127 } |
| 128 |
| 129 PassRefPtr<AbstractScriptValue> DartScriptState::idbKeyToScriptValue(IDBKey* key
) |
| 130 { |
| 131 RELEASE_ASSERT_NOT_REACHED(); |
| 132 return reinterpret_cast<AbstractScriptValue*>(0); |
| 133 } |
| 134 |
| 135 #ifndef NDEBUG |
| 136 void DartScriptState::assertPrimaryKeyValidOrInjectable(PassRefPtr<SharedBuffer>
buffer, const Vector<blink::WebBlobInfo>* blobInfo, IDBKey* key, const IDBKeyPa
th& keyPath) |
| 137 { |
| 138 RELEASE_ASSERT_NOT_REACHED(); |
| 139 } |
| 140 #endif |
| 141 |
| 142 } // namespace blink |
OLD | NEW |