| OLD | NEW |
| 1 // Copyright 2013, Google Inc. | 1 // Copyright 2013, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "bindings/core/v8/V8ScriptState.h" | 33 #include "bindings/core/v8/V8ScriptState.h" |
| 34 | 34 |
| 35 #include <dart_api.h> | 35 #include <dart_api.h> |
| 36 #include <v8.h> | 36 #include <v8.h> |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class DartScriptState : public ScriptState { | 40 class DartScriptState : public ScriptState { |
| 41 WTF_MAKE_NONCOPYABLE(DartScriptState); | 41 WTF_MAKE_NONCOPYABLE(DartScriptState); |
| 42 public: | 42 public: |
| 43 static PassRefPtr<DartScriptState> create(Dart_Isolate isolate, intptr_t lib
raryId, V8ScriptState* v8ScriptState) | 43 static PassRefPtr<DartScriptState> create(Dart_Isolate isolate, intptr_t lib
raryId, V8ScriptState* v8ScriptState, const String& isolateName) |
| 44 { | 44 { |
| 45 return adoptRef(new DartScriptState(isolate, libraryId, v8ScriptState)); | 45 return adoptRef(new DartScriptState(isolate, libraryId, v8ScriptState, i
solateName)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Long term we want to be creating DartScriptStates without V8ScriptStates. | 48 // Long term we want to be creating DartScriptStates without V8ScriptStates. |
| 49 static PassRefPtr<DartScriptState> create(Dart_Isolate isolate, intptr_t lib
raryId) | 49 static PassRefPtr<DartScriptState> create(Dart_Isolate isolate, intptr_t lib
raryId, const String& isolateName) |
| 50 { | 50 { |
| 51 return adoptRef(new DartScriptState(isolate, libraryId, 0)); | 51 return adoptRef(new DartScriptState(isolate, libraryId, 0, isolateName))
; |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool isDartScriptState() const { return true; } | 54 bool isDartScriptState() const { return true; } |
| 55 V8ScriptState* v8ScriptState() | 55 V8ScriptState* v8ScriptState() |
| 56 { | 56 { |
| 57 ASSERT(m_v8ScriptState); | 57 ASSERT(m_v8ScriptState); |
| 58 return m_v8ScriptState.get(); | 58 return m_v8ScriptState.get(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 LocalDOMWindow* domWindow() const { return m_v8ScriptState->domWindow(); } | 61 LocalDOMWindow* domWindow() const { return m_v8ScriptState->domWindow(); } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 80 PassRefPtr<AbstractScriptPromise> createRejectedPromise(PassRefPtrWillBeRawP
tr<DOMException>); | 80 PassRefPtr<AbstractScriptPromise> createRejectedPromise(PassRefPtrWillBeRawP
tr<DOMException>); |
| 81 PassRefPtr<AbstractScriptPromise> createPromiseRejectedWithTypeError(const S
tring& message); | 81 PassRefPtr<AbstractScriptPromise> createPromiseRejectedWithTypeError(const S
tring& message); |
| 82 virtual PassOwnPtr<AbstractScriptPromiseResolver> createPromiseResolver(Scri
ptPromiseResolver*); | 82 virtual PassOwnPtr<AbstractScriptPromiseResolver> createPromiseResolver(Scri
ptPromiseResolver*); |
| 83 AbstractScriptStateProtectingContext* createProtectingContext(); | 83 AbstractScriptStateProtectingContext* createProtectingContext(); |
| 84 PassRefPtr<AbstractScriptValue> idbAnyToScriptValue(IDBAny*); | 84 PassRefPtr<AbstractScriptValue> idbAnyToScriptValue(IDBAny*); |
| 85 PassRefPtr<AbstractScriptValue> idbKeyToScriptValue(IDBKey*); | 85 PassRefPtr<AbstractScriptValue> idbKeyToScriptValue(IDBKey*); |
| 86 | 86 |
| 87 Dart_Isolate isolate() { return m_isolate; } | 87 Dart_Isolate isolate() { return m_isolate; } |
| 88 virtual intptr_t libraryId() { return m_libraryId; } | 88 virtual intptr_t libraryId() { return m_libraryId; } |
| 89 | 89 |
| 90 virtual const String* name() { return &m_libraryUrl; } | 90 virtual const String* name() { return &m_name; } |
| 91 virtual bool isJavaScript() { return false; } | 91 virtual bool isJavaScript() { return false; } |
| 92 | 92 |
| 93 #ifndef NDEBUG | 93 #ifndef NDEBUG |
| 94 void assertPrimaryKeyValidOrInjectable(PassRefPtr<SharedBuffer>, const Vecto
r<blink::WebBlobInfo>*, IDBKey*, const IDBKeyPath&); | 94 void assertPrimaryKeyValidOrInjectable(PassRefPtr<SharedBuffer>, const Vecto
r<blink::WebBlobInfo>*, IDBKey*, const IDBKeyPath&); |
| 95 #endif | 95 #endif |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 explicit DartScriptState(Dart_Isolate, intptr_t libraryId, V8ScriptState*); | 98 explicit DartScriptState(Dart_Isolate, intptr_t libraryId, V8ScriptState*, c
onst String& isolateName); |
| 99 ~DartScriptState() { } | 99 ~DartScriptState() { } |
| 100 | 100 |
| 101 Dart_Isolate m_isolate; | 101 Dart_Isolate m_isolate; |
| 102 intptr_t m_libraryId; | 102 intptr_t m_libraryId; |
| 103 String m_libraryUrl; | 103 String m_name; |
| 104 RefPtr<V8ScriptState> m_v8ScriptState; | 104 RefPtr<V8ScriptState> m_v8ScriptState; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 } | 107 } |
| 108 | 108 |
| 109 #endif // DartScriptState_h | 109 #endif // DartScriptState_h |
| OLD | NEW |