OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. 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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "modules/indexeddb/InspectorIndexedDBAgent.h" | 31 #include "modules/indexeddb/InspectorIndexedDBAgent.h" |
32 | 32 |
33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
34 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
35 #include "bindings/core/v8/ScriptState.h" | 35 #include "bindings/core/v8/ScriptState.h" |
36 #include "bindings/core/v8/V8Binding.h" | 36 #include "bindings/core/v8/V8Binding.h" |
37 #include "bindings/core/v8/V8PerIsolateData.h" | 37 #include "bindings/core/v8/V8PerIsolateData.h" |
38 #include "core/dom/DOMStringList.h" | 38 #include "core/dom/DOMStringList.h" |
39 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
| 40 #include "core/dom/ExecutionContext.h" |
40 #include "core/events/EventListener.h" | 41 #include "core/events/EventListener.h" |
41 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
42 #include "core/inspector/InspectedFrames.h" | 43 #include "core/inspector/InspectedFrames.h" |
43 #include "core/inspector/V8InspectorString.h" | 44 #include "core/inspector/V8InspectorString.h" |
44 #include "modules/IndexedDBNames.h" | 45 #include "modules/IndexedDBNames.h" |
45 #include "modules/indexeddb/GlobalIndexedDB.h" | 46 #include "modules/indexeddb/GlobalIndexedDB.h" |
46 #include "modules/indexeddb/IDBCursor.h" | 47 #include "modules/indexeddb/IDBCursor.h" |
47 #include "modules/indexeddb/IDBCursorWithValue.h" | 48 #include "modules/indexeddb/IDBCursorWithValue.h" |
48 #include "modules/indexeddb/IDBDatabase.h" | 49 #include "modules/indexeddb/IDBDatabase.h" |
49 #include "modules/indexeddb/IDBFactory.h" | 50 #include "modules/indexeddb/IDBFactory.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 return; | 212 return; |
212 } | 213 } |
213 idb_open_db_request->addEventListener(EventTypeNames::upgradeneeded, | 214 idb_open_db_request->addEventListener(EventTypeNames::upgradeneeded, |
214 upgrade_callback, false); | 215 upgrade_callback, false); |
215 idb_open_db_request->addEventListener(EventTypeNames::success, | 216 idb_open_db_request->addEventListener(EventTypeNames::success, |
216 open_callback, false); | 217 open_callback, false); |
217 } | 218 } |
218 virtual void Execute(IDBDatabase*) = 0; | 219 virtual void Execute(IDBDatabase*) = 0; |
219 virtual RequestCallback* GetRequestCallback() = 0; | 220 virtual RequestCallback* GetRequestCallback() = 0; |
220 ExecutionContext* Context() const { | 221 ExecutionContext* Context() const { |
221 return script_state_->GetExecutionContext(); | 222 return ExecutionContext::From(script_state_.Get()); |
222 } | 223 } |
223 ScriptState* GetScriptState() const { return script_state_.Get(); } | 224 ScriptState* GetScriptState() const { return script_state_.Get(); } |
224 | 225 |
225 private: | 226 private: |
226 RefPtr<ScriptState> script_state_; | 227 RefPtr<ScriptState> script_state_; |
227 }; | 228 }; |
228 | 229 |
229 template <typename RequestCallback> | 230 template <typename RequestCallback> |
230 class OpenDatabaseCallback final : public EventListener { | 231 class OpenDatabaseCallback final : public EventListener { |
231 public: | 232 public: |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 // Continue cursor before making injected script calls, otherwise | 566 // Continue cursor before making injected script calls, otherwise |
566 // transaction might be finished. | 567 // transaction might be finished. |
567 DummyExceptionStateForTesting exception_state; | 568 DummyExceptionStateForTesting exception_state; |
568 idb_cursor->Continue(nullptr, nullptr, exception_state); | 569 idb_cursor->Continue(nullptr, nullptr, exception_state); |
569 if (exception_state.HadException()) { | 570 if (exception_state.HadException()) { |
570 request_callback_->sendFailure( | 571 request_callback_->sendFailure( |
571 Response::Error("Could not continue cursor.")); | 572 Response::Error("Could not continue cursor.")); |
572 return; | 573 return; |
573 } | 574 } |
574 | 575 |
575 Document* document = ToDocument(script_state_->GetExecutionContext()); | 576 Document* document = |
| 577 ToDocument(ExecutionContext::From(script_state_.Get())); |
576 if (!document) | 578 if (!document) |
577 return; | 579 return; |
578 ScriptState* script_state = script_state_.Get(); | 580 ScriptState* script_state = script_state_.Get(); |
579 ScriptState::Scope scope(script_state); | 581 ScriptState::Scope scope(script_state); |
580 v8::Local<v8::Context> context = script_state->GetContext(); | 582 v8::Local<v8::Context> context = script_state->GetContext(); |
581 v8_inspector::StringView object_group = | 583 v8_inspector::StringView object_group = |
582 ToV8InspectorStringView(kIndexedDBObjectGroup); | 584 ToV8InspectorStringView(kIndexedDBObjectGroup); |
583 std::unique_ptr<DataEntry> data_entry = | 585 std::unique_ptr<DataEntry> data_entry = |
584 DataEntry::create() | 586 DataEntry::create() |
585 .setKey(v8_session_->wrapObject( | 587 .setKey(v8_session_->wrapObject( |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 document->GetSecurityOrigin()->ToRawString()), | 1035 document->GetSecurityOrigin()->ToRawString()), |
1034 false); | 1036 false); |
1035 } | 1037 } |
1036 | 1038 |
1037 DEFINE_TRACE(InspectorIndexedDBAgent) { | 1039 DEFINE_TRACE(InspectorIndexedDBAgent) { |
1038 visitor->Trace(inspected_frames_); | 1040 visitor->Trace(inspected_frames_); |
1039 InspectorBaseAgent::Trace(visitor); | 1041 InspectorBaseAgent::Trace(visitor); |
1040 } | 1042 } |
1041 | 1043 |
1042 } // namespace blink | 1044 } // namespace blink |
OLD | NEW |