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

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

Issue 17030009: Inspector: wrapped inspector agent instances into factory-like wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made InspectorBaseAgent RefCounted Created 7 years, 6 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return false; 64 return false;
65 case SECURITY_ERR: 65 case SECURITY_ERR:
66 *errorString = "Security error"; 66 *errorString = "Security error";
67 return true; 67 return true;
68 default: 68 default:
69 *errorString = "Unknown DOM storage error"; 69 *errorString = "Unknown DOM storage error";
70 return true; 70 return true;
71 } 71 }
72 } 72 }
73 73
74 InspectorDOMStorageAgent::InspectorDOMStorageAgent(InstrumentingAgents* instrume ntingAgents, InspectorPageAgent* pageAgent, InspectorCompositeState* state) 74 PassRefPtr<InspectorDOMStorageAgent> InspectorDOMStorageAgent::create(Instrument ingAgents* instrumentingAgents, InspectorState* state, PassRefPtr<InspectorPageA gent> pageAgent)
75 : InspectorBaseAgent<InspectorDOMStorageAgent>("DOMStorage", instrumentingAg ents, state) 75 {
76 return adoptRef(new InspectorDOMStorageAgent(instrumentingAgents, state, pag eAgent));
77 }
78
79 InspectorDOMStorageAgent::InspectorDOMStorageAgent(InstrumentingAgents* instrume ntingAgents, InspectorState* state, PassRefPtr<InspectorPageAgent> pageAgent)
80 : InspectorBaseAgent(instrumentingAgents, state)
76 , m_pageAgent(pageAgent) 81 , m_pageAgent(pageAgent)
77 , m_frontend(0) 82 , m_frontend(0)
78 { 83 {
79 m_instrumentingAgents->setInspectorDOMStorageAgent(this); 84 m_instrumentingAgents->setInspectorDOMStorageAgent(this);
80 } 85 }
81 86
82 InspectorDOMStorageAgent::~InspectorDOMStorageAgent() 87 InspectorDOMStorageAgent::~InspectorDOMStorageAgent()
83 { 88 {
84 m_instrumentingAgents->setInspectorDOMStorageAgent(0); 89 m_instrumentingAgents->setInspectorDOMStorageAgent(0);
85 m_instrumentingAgents = 0; 90 m_instrumentingAgents = 0;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 237
233 Page* page = m_pageAgent->page(); 238 Page* page = m_pageAgent->page();
234 if (isLocalStorage) 239 if (isLocalStorage)
235 return page->group().localStorage()->storageArea(frame->document()->secu rityOrigin()); 240 return page->group().localStorage()->storageArea(frame->document()->secu rityOrigin());
236 return page->sessionStorage()->storageArea(frame->document()->securityOrigin ()); 241 return page->sessionStorage()->storageArea(frame->document()->securityOrigin ());
237 } 242 }
238 243
239 void InspectorDOMStorageAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectI nfo) const 244 void InspectorDOMStorageAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectI nfo) const
240 { 245 {
241 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorDO MStorageAgent); 246 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorDO MStorageAgent);
242 InspectorBaseAgent<InspectorDOMStorageAgent>::reportMemoryUsage(memoryObject Info); 247 InspectorBaseAgent::reportMemoryUsage(memoryObjectInfo);
243 info.addWeakPointer(m_frontend); 248 info.addWeakPointer(m_frontend);
244 } 249 }
245 250
251 InspectorDOMStorageController::InspectorDOMStorageController(InstrumentingAgents * instrumentingAgents, InspectorCompositeState* compositeState, InspectorPageCon troller* pageController)
252 : InspectorBaseController<InspectorDOMStorageController, InspectorDOMStorage Agent>("DOMStorage", instrumentingAgents, compositeState)
253 {
254 setAgent(InspectorDOMStorageAgent::create(m_instrumentingAgents, m_state, pa geController->getAgent()));
255 }
256
246 } // namespace WebCore 257 } // namespace WebCore
247 258
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698