1/* 2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#include "config.h" 32 33#if ENABLE(INSPECTOR) 34 35#include "InstrumentingAgents.h" 36 37#include "InspectorController.h" 38#include "Page.h" 39#include "WorkerContext.h" 40#include "WorkerInspectorController.h" 41#include <wtf/MainThread.h> 42 43namespace WebCore { 44 45InstrumentingAgents::InstrumentingAgents() 46 : m_inspectorAgent(0) 47 , m_inspectorPageAgent(0) 48 , m_inspectorCSSAgent(0) 49#if USE(ACCELERATED_COMPOSITING) 50 , m_inspectorLayerTreeAgent(0) 51#endif 52 , m_inspectorConsoleAgent(0) 53 , m_inspectorDOMAgent(0) 54 , m_inspectorResourceAgent(0) 55 , m_pageRuntimeAgent(0) 56 , m_workerRuntimeAgent(0) 57 , m_inspectorTimelineAgent(0) 58 , m_inspectorDOMStorageAgent(0) 59#if ENABLE(SQL_DATABASE) 60 , m_inspectorDatabaseAgent(0) 61#endif 62#if ENABLE(FILE_SYSTEM) 63 , m_inspectorFileSystemAgent(0) 64#endif 65 , m_inspectorApplicationCacheAgent(0) 66#if ENABLE(JAVASCRIPT_DEBUGGER) 67 , m_inspectorDebuggerAgent(0) 68 , m_pageDebuggerAgent(0) 69 , m_inspectorDOMDebuggerAgent(0) 70 , m_inspectorProfilerAgent(0) 71#endif 72#if ENABLE(WORKERS) 73 , m_inspectorWorkerAgent(0) 74#endif 75 , m_inspectorCanvasAgent(0) 76{ 77} 78 79void InstrumentingAgents::reset() 80{ 81 m_inspectorAgent = 0; 82 m_inspectorPageAgent = 0; 83 m_inspectorCSSAgent = 0; 84#if USE(ACCELERATED_COMPOSITING) 85 m_inspectorLayerTreeAgent = 0; 86#endif 87 m_inspectorConsoleAgent = 0; 88 m_inspectorDOMAgent = 0; 89 m_inspectorResourceAgent = 0; 90 m_pageRuntimeAgent = 0; 91 m_workerRuntimeAgent = 0; 92 m_inspectorTimelineAgent = 0; 93 m_inspectorDOMStorageAgent = 0; 94#if ENABLE(SQL_DATABASE) 95 m_inspectorDatabaseAgent = 0; 96#endif 97#if ENABLE(FILE_SYSTEM) 98 m_inspectorFileSystemAgent = 0; 99#endif 100 m_inspectorApplicationCacheAgent = 0; 101#if ENABLE(JAVASCRIPT_DEBUGGER) 102 m_inspectorDebuggerAgent = 0; 103 m_pageDebuggerAgent = 0; 104 m_inspectorDOMDebuggerAgent = 0; 105 m_inspectorProfilerAgent = 0; 106#endif 107#if ENABLE(WORKERS) 108 m_inspectorWorkerAgent = 0; 109#endif 110 m_inspectorCanvasAgent = 0; 111} 112 113InstrumentingAgents* instrumentationForPage(Page* page) 114{ 115 ASSERT(isMainThread()); 116 if (InspectorController* controller = page->inspectorController()) 117 return controller->m_instrumentingAgents.get(); 118 return 0; 119} 120 121#if ENABLE(WORKERS) 122InstrumentingAgents* instrumentationForWorkerContext(WorkerContext* workerContext) 123{ 124 if (WorkerInspectorController* controller = workerContext->workerInspectorController()) 125 return controller->m_instrumentingAgents.get(); 126 return 0; 127} 128#endif 129 130} // namespace WebCore 131 132#endif // ENABLE(INSPECTOR) 133