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