| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 RawPtrWillBeMember<InstrumentingAgents> m_instrumentingAgents; | 95 RawPtrWillBeMember<InstrumentingAgents> m_instrumentingAgents; |
| 96 RawPtrWillBeMember<InspectorCompositeState> m_inspectorState; | 96 RawPtrWillBeMember<InspectorCompositeState> m_inspectorState; |
| 97 WillBeHeapVector<OwnPtrWillBeMember<InspectorAgent> > m_agents; | 97 WillBeHeapVector<OwnPtrWillBeMember<InspectorAgent> > m_agents; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 template<typename AgentClass, typename FrontendClass> | 100 template<typename AgentClass, typename FrontendClass> |
| 101 class InspectorBaseAgent : public InspectorAgent { | 101 class InspectorBaseAgent : public InspectorAgent { |
| 102 public: | 102 public: |
| 103 virtual ~InspectorBaseAgent() { } | 103 ~InspectorBaseAgent() override { } |
| 104 | 104 |
| 105 void setFrontend(InspectorFrontend* frontend) override final | 105 void setFrontend(InspectorFrontend* frontend) final |
| 106 { | 106 { |
| 107 ASSERT(!m_frontend); | 107 ASSERT(!m_frontend); |
| 108 m_frontend = FrontendClass::from(frontend); | 108 m_frontend = FrontendClass::from(frontend); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void clearFrontend() override final | 111 void clearFrontend() final |
| 112 { | 112 { |
| 113 ErrorString error; | 113 ErrorString error; |
| 114 disable(&error); | 114 disable(&error); |
| 115 ASSERT(m_frontend); | 115 ASSERT(m_frontend); |
| 116 m_frontend = nullptr; | 116 m_frontend = nullptr; |
| 117 } | 117 } |
| 118 | 118 |
| 119 virtual void registerInDispatcher(InspectorBackendDispatcher* dispatcher) ov
erride final | 119 void registerInDispatcher(InspectorBackendDispatcher* dispatcher) final |
| 120 { | 120 { |
| 121 dispatcher->registerAgent(static_cast<AgentClass*>(this)); | 121 dispatcher->registerAgent(static_cast<AgentClass*>(this)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 protected: | 124 protected: |
| 125 explicit InspectorBaseAgent(const String& name) | 125 explicit InspectorBaseAgent(const String& name) |
| 126 : InspectorAgent(name) | 126 : InspectorAgent(name) |
| 127 , m_frontend(nullptr) | 127 , m_frontend(nullptr) |
| 128 { | 128 { |
| 129 } | 129 } |
| 130 | 130 |
| 131 FrontendClass* frontend() const { return m_frontend; } | 131 FrontendClass* frontend() const { return m_frontend; } |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 FrontendClass* m_frontend; | 134 FrontendClass* m_frontend; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 inline bool asBool(const bool* const b) | 137 inline bool asBool(const bool* const b) |
| 138 { | 138 { |
| 139 return b ? *b : false; | 139 return b ? *b : false; |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace blink | 142 } // namespace blink |
| 143 | 143 |
| 144 #endif // !defined(InspectorBaseAgent_h) | 144 #endif // !defined(InspectorBaseAgent_h) |
| OLD | NEW |