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

Side by Side Diff: Source/core/inspector/InspectorLayerTreeAgent.h

Issue 17030009: Inspector: wrapped inspector agent instances into factory-like wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comments 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) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 28 matching lines...) Expand all
39 #include <wtf/text/WTFString.h> 39 #include <wtf/text/WTFString.h>
40 #include <wtf/Vector.h> 40 #include <wtf/Vector.h>
41 41
42 namespace WebCore { 42 namespace WebCore {
43 43
44 class InspectorState; 44 class InspectorState;
45 class InstrumentingAgents; 45 class InstrumentingAgents;
46 46
47 typedef String ErrorString; 47 typedef String ErrorString;
48 48
49 class InspectorLayerTreeAgent : public InspectorBaseAgent<InspectorLayerTreeAgen t>, public InspectorBackendDispatcher::LayerTreeCommandHandler { 49 class InspectorLayerTreeAgent : public InspectorBaseAgent, public InspectorBacke ndDispatcher::LayerTreeCommandHandler {
50 public: 50 public:
51 static PassOwnPtr<InspectorLayerTreeAgent> create(InstrumentingAgents* instr umentingAgents, InspectorCompositeState* state) 51 static PassRefPtr<InspectorLayerTreeAgent> create(InstrumentingAgents* instr umentingAgents, InspectorState* state)
52 { 52 {
53 return adoptPtr(new InspectorLayerTreeAgent(instrumentingAgents, state)) ; 53 return adoptRef(new InspectorLayerTreeAgent(instrumentingAgents, state)) ;
54 } 54 }
55 ~InspectorLayerTreeAgent(); 55 virtual ~InspectorLayerTreeAgent();
56 56
57 virtual void setFrontend(InspectorFrontend*); 57 virtual void setFrontend(InspectorFrontend*);
58 virtual void clearFrontend(); 58 virtual void clearFrontend();
59 virtual void restore(); 59 virtual void restore();
60 void reset(); 60 void reset();
61 61
62 void didCommitLoad(Frame*, DocumentLoader*); 62 void didCommitLoad(Frame*, DocumentLoader*);
63 void layerTreeDidChange(); 63 void layerTreeDidChange();
64 void renderLayerDestroyed(const RenderLayer*); 64 void renderLayerDestroyed(const RenderLayer*);
65 void pseudoElementDestroyed(PseudoElement*); 65 void pseudoElementDestroyed(PseudoElement*);
66 66
67 // Called from the front-end. 67 // Called from the front-end.
68 virtual void enable(ErrorString*); 68 virtual void enable(ErrorString*);
69 virtual void disable(ErrorString*); 69 virtual void disable(ErrorString*);
70 virtual void layersForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::Arr ay<TypeBuilder::LayerTree::Layer> >&); 70 virtual void layersForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::Arr ay<TypeBuilder::LayerTree::Layer> >&);
71 virtual void reasonsForCompositingLayer(ErrorString*, const String& layerId, RefPtr<TypeBuilder::LayerTree::CompositingReasons>&); 71 virtual void reasonsForCompositingLayer(ErrorString*, const String& layerId, RefPtr<TypeBuilder::LayerTree::CompositingReasons>&);
72 72
73 private: 73 private:
74 InspectorLayerTreeAgent(InstrumentingAgents*, InspectorCompositeState*); 74 InspectorLayerTreeAgent(InstrumentingAgents*, InspectorState*);
75 75
76 // RenderLayer-related methods. 76 // RenderLayer-related methods.
77 String bind(const RenderLayer*); 77 String bind(const RenderLayer*);
78 void unbind(const RenderLayer*); 78 void unbind(const RenderLayer*);
79 79
80 void gatherLayersUsingRenderObjectHierarchy(ErrorString*, RenderObject*, Ref Ptr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >&); 80 void gatherLayersUsingRenderObjectHierarchy(ErrorString*, RenderObject*, Ref Ptr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >&);
81 void gatherLayersUsingRenderLayerHierarchy(ErrorString*, RenderLayer*, RefPt r<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >&); 81 void gatherLayersUsingRenderLayerHierarchy(ErrorString*, RenderLayer*, RefPt r<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >&);
82 82
83 PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(ErrorString*, RenderLayer*); 83 PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(ErrorString*, RenderLayer*);
84 PassRefPtr<TypeBuilder::LayerTree::IntRect> buildObjectForIntRect(const IntR ect&); 84 PassRefPtr<TypeBuilder::LayerTree::IntRect> buildObjectForIntRect(const IntR ect&);
85 85
86 int idForNode(ErrorString*, Node*); 86 int idForNode(ErrorString*, Node*);
87 87
88 String bindPseudoElement(PseudoElement*); 88 String bindPseudoElement(PseudoElement*);
89 void unbindPseudoElement(PseudoElement*); 89 void unbindPseudoElement(PseudoElement*);
90 90
91 InspectorFrontend::LayerTree* m_frontend; 91 InspectorFrontend::LayerTree* m_frontend;
92 92
93 HashMap<const RenderLayer*, String> m_documentLayerToIdMap; 93 HashMap<const RenderLayer*, String> m_documentLayerToIdMap;
94 HashMap<String, const RenderLayer*> m_idToLayer; 94 HashMap<String, const RenderLayer*> m_idToLayer;
95 95
96 HashMap<PseudoElement*, String> m_pseudoElementToIdMap; 96 HashMap<PseudoElement*, String> m_pseudoElementToIdMap;
97 HashMap<String, PseudoElement*> m_idToPseudoElement; 97 HashMap<String, PseudoElement*> m_idToPseudoElement;
98 }; 98 };
99 99
100 class InspectorLayerTreeFactory : public InspectorBaseFactory<InspectorLayerTree Factory, InspectorLayerTreeAgent> {
101 public:
102
103 static PassOwnPtr<InspectorLayerTreeFactory> create(InstrumentingAgents* ins trumentingAgents, InspectorCompositeState* compositeState)
104 {
105 return adoptPtr(new InspectorLayerTreeFactory(instrumentingAgents, compo siteState));
106 }
107
108 protected:
109 InspectorLayerTreeFactory(InstrumentingAgents* instrumentingAgents, Inspecto rCompositeState* compositeState)
110 : InspectorBaseFactory<InspectorLayerTreeFactory, InspectorLayerTreeAgen t>("LayerTree", instrumentingAgents, compositeState)
111 {
112 setAgent(InspectorLayerTreeAgent::create(m_instrumentingAgents, m_state) );
113 }
114 };
115
100 } // namespace WebCore 116 } // namespace WebCore
101 117
102 118
103 #endif // !defined(InspectorLayerTreeAgent_h) 119 #endif // !defined(InspectorLayerTreeAgent_h)
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorInputAgent.cpp ('k') | Source/core/inspector/InspectorLayerTreeAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698