Use "= default" to denote default constructor or destructor
[WebKit-https.git] / Source / WebCore / inspector / PageRuntimeAgent.h
index 76a04c1..14061de 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef PageRuntimeAgent_h
-#define PageRuntimeAgent_h
+#pragma once
 
-#if ENABLE(INSPECTOR)
+#include "InspectorWebAgentBase.h"
+#include <inspector/InspectorFrontendDispatchers.h>
+#include <inspector/agents/InspectorRuntimeAgent.h>
 
-#include "InspectorRuntimeAgent.h"
-#include "InspectorWebFrontendDispatchers.h"
-#include "ScriptState.h"
-#include <wtf/PassOwnPtr.h>
-
-namespace Inspector {
-class InjectedScriptManager;
+namespace JSC {
+class ExecState;
 }
 
 namespace WebCore {
 
 class InspectorPageAgent;
+class Frame;
 class Page;
 class SecurityOrigin;
+typedef String ErrorString;
 
-class PageRuntimeAgent : public InspectorRuntimeAgent {
+class PageRuntimeAgent final : public Inspector::InspectorRuntimeAgent {
+    WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<PageRuntimeAgent> create(InstrumentingAgents* instrumentingAgents, Inspector::InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent)
-    {
-        return adoptPtr(new PageRuntimeAgent(instrumentingAgents, injectedScriptManager, page, pageAgent));
-    }
-    virtual ~PageRuntimeAgent();
-    virtual void didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel*, Inspector::InspectorBackendDispatcher*) OVERRIDE;
-    virtual void willDestroyFrontendAndBackend() OVERRIDE;
-    virtual void enable(ErrorString*);
-    virtual void disable(ErrorString*);
+    PageRuntimeAgent(PageAgentContext&, InspectorPageAgent*);
+    virtual ~PageRuntimeAgent() = default;
 
-    void didCreateMainWorldContext(Frame*);
-    void didCreateIsolatedContext(Frame*, JSC::ExecState*, SecurityOrigin*);
+    void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
+    void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
+    void enable(ErrorString&) override;
+    void disable(ErrorString&) override;
 
-private:
-    PageRuntimeAgent(InstrumentingAgents*, Inspector::InjectedScriptManager*, Page*, InspectorPageAgent*);
+    // InspectorInstrumentation
+    void didCreateMainWorldContext(Frame&);
 
-    virtual Inspector::InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId);
-    virtual void muteConsole();
-    virtual void unmuteConsole();
+private:
+    Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
+    void muteConsole() override;
+    void unmuteConsole() override;
     void reportExecutionContextCreation();
     void notifyContextCreated(const String& frameId, JSC::ExecState*, SecurityOrigin*, bool isPageContext);
 
-    Page* m_inspectedPage;
+    std::unique_ptr<Inspector::RuntimeFrontendDispatcher> m_frontendDispatcher;
+    RefPtr<Inspector::RuntimeBackendDispatcher> m_backendDispatcher;
     InspectorPageAgent* m_pageAgent;
-    std::unique_ptr<Inspector::InspectorRuntimeFrontendDispatcher> m_frontendDispatcher;
-    RefPtr<Inspector::InspectorRuntimeBackendDispatcher> m_backendDispatcher;
-    bool m_mainWorldContextCreated;
-};
 
-} // namespace WebCore
+    Page& m_inspectedPage;
 
-#endif // ENABLE(INSPECTOR)
+    bool m_mainWorldContextCreated { false };
+};
 
-#endif // !defined(InspectorPagerAgent_h)
+} // namespace WebCore