Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: Source/core/inspector/InspectorDOMStorageAgent.cpp

Issue 892693006: Revert of DevTools: use per-LocalFrame instrumenting agents instead of per-Page ones. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 22 matching lines...) Expand all
33 #include "bindings/core/v8/ExceptionState.h" 33 #include "bindings/core/v8/ExceptionState.h"
34 #include "core/InspectorFrontend.h" 34 #include "core/InspectorFrontend.h"
35 #include "core/dom/DOMException.h" 35 #include "core/dom/DOMException.h"
36 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/dom/ExceptionCode.h" 37 #include "core/dom/ExceptionCode.h"
38 #include "core/inspector/InspectorPageAgent.h" 38 #include "core/inspector/InspectorPageAgent.h"
39 #include "core/inspector/InspectorState.h" 39 #include "core/inspector/InspectorState.h"
40 #include "core/inspector/InstrumentingAgents.h" 40 #include "core/inspector/InstrumentingAgents.h"
41 #include "core/frame/LocalDOMWindow.h" 41 #include "core/frame/LocalDOMWindow.h"
42 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
43 #include "core/page/Page.h"
43 #include "core/storage/Storage.h" 44 #include "core/storage/Storage.h"
44 #include "core/storage/StorageNamespace.h" 45 #include "core/storage/StorageNamespace.h"
45 #include "core/storage/StorageNamespaceController.h" 46 #include "core/storage/StorageNamespaceController.h"
46 #include "platform/JSONValues.h" 47 #include "platform/JSONValues.h"
47 #include "platform/weborigin/SecurityOrigin.h" 48 #include "platform/weborigin/SecurityOrigin.h"
48 49
49 namespace blink { 50 namespace blink {
50 51
51 namespace DOMStorageAgentState { 52 namespace DOMStorageAgentState {
52 static const char domStorageAgentEnabled[] = "domStorageAgentEnabled"; 53 static const char domStorageAgentEnabled[] = "domStorageAgentEnabled";
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 *errorString = toErrorString(exceptionState); 179 *errorString = toErrorString(exceptionState);
179 } 180 }
180 181
181 PassRefPtr<TypeBuilder::DOMStorage::StorageId> InspectorDOMStorageAgent::storage Id(SecurityOrigin* securityOrigin, bool isLocalStorage) 182 PassRefPtr<TypeBuilder::DOMStorage::StorageId> InspectorDOMStorageAgent::storage Id(SecurityOrigin* securityOrigin, bool isLocalStorage)
182 { 183 {
183 return TypeBuilder::DOMStorage::StorageId::create() 184 return TypeBuilder::DOMStorage::StorageId::create()
184 .setSecurityOrigin(securityOrigin->toRawString()) 185 .setSecurityOrigin(securityOrigin->toRawString())
185 .setIsLocalStorage(isLocalStorage).release(); 186 .setIsLocalStorage(isLocalStorage).release();
186 } 187 }
187 188
188 void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(LocalFrame* frame, con st String& key, const String& oldValue, const String& newValue, StorageType stor ageType, SecurityOrigin* securityOrigin) 189 void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(const String& key, con st String& oldValue, const String& newValue, StorageType storageType, SecurityOr igin* securityOrigin)
189 { 190 {
190 if (!m_frontend || !isEnabled() || frame != m_pageAgent->inspectedFrame()) 191 if (!m_frontend || !isEnabled())
191 return; 192 return;
192 193
193 RefPtr<TypeBuilder::DOMStorage::StorageId> id = storageId(securityOrigin, st orageType == LocalStorage); 194 RefPtr<TypeBuilder::DOMStorage::StorageId> id = storageId(securityOrigin, st orageType == LocalStorage);
194 195
195 if (key.isNull()) 196 if (key.isNull())
196 m_frontend->domStorageItemsCleared(id); 197 m_frontend->domStorageItemsCleared(id);
197 else if (newValue.isNull()) 198 else if (newValue.isNull())
198 m_frontend->domStorageItemRemoved(id, key); 199 m_frontend->domStorageItemRemoved(id, key);
199 else if (oldValue.isNull()) 200 else if (oldValue.isNull())
200 m_frontend->domStorageItemAdded(id, key, newValue); 201 m_frontend->domStorageItemAdded(id, key, newValue);
(...skipping 17 matching lines...) Expand all
218 LocalFrame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin) ; 219 LocalFrame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin) ;
219 if (!frame) { 220 if (!frame) {
220 if (errorString) 221 if (errorString)
221 *errorString = "LocalFrame not found for the given security origin"; 222 *errorString = "LocalFrame not found for the given security origin";
222 return nullptr; 223 return nullptr;
223 } 224 }
224 targetFrame = frame; 225 targetFrame = frame;
225 226
226 if (isLocalStorage) 227 if (isLocalStorage)
227 return StorageNamespace::localStorageArea(frame->document()->securityOri gin()); 228 return StorageNamespace::localStorageArea(frame->document()->securityOri gin());
228 return StorageNamespaceController::from(frame->page())->sessionStorage()->st orageArea(frame->document()->securityOrigin()); 229 return StorageNamespaceController::from(m_pageAgent->page())->sessionStorage ()->storageArea(frame->document()->securityOrigin());
229 } 230 }
230 231
231 } // namespace blink 232 } // namespace blink
232 233
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorDOMStorageAgent.h ('k') | Source/core/inspector/InspectorInputAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698