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

Side by Side Diff: Source/bindings/v8/V8PerContextDebugData.h

Issue 13575004: Apply script preprocessor to Web page scripts only. (Closed) Base URL: https://chromium.googlesource.com/external/WebKit_trimmed.git@master
Patch Set: Rebase, simplify Created 7 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef InspectorHistory_h 31 #ifndef V8PerContextDebugData_h
32 #define InspectorHistory_h 32 #define V8PerContextDebugData_h
33 33
34 #include "ExceptionCode.h" 34 #include <v8.h>
35 35 #include "wtf/text/WTFString.h"
36 #include <wtf/OwnPtr.h>
37 #include <wtf/Vector.h>
38 #include <wtf/text/WTFString.h>
39 36
40 namespace WebCore { 37 namespace WebCore {
41 38
42 class ContainerNode; 39 enum V8ContextEmbedderDataField {
43 class Element; 40 v8ContextDebugIdIndex,
44 class Node; 41 v8ContextPerContextDataIndex,
45 42 v8ContextIsolatedWorld,
46 43 v8ContextCreatorIndex
47 class InspectorHistory { 44 // Rather than adding more embedder data fields to v8::Context,
48 WTF_MAKE_NONCOPYABLE(InspectorHistory); WTF_MAKE_FAST_ALLOCATED; 45 // consider adding the data to V8PerContextData instead.
49 public:
50 class Action {
51 WTF_MAKE_FAST_ALLOCATED;
52 public:
53 Action(const String& name);
54 virtual ~Action();
55 virtual String toString();
56
57 virtual String mergeId();
58 virtual void merge(PassOwnPtr<Action>);
59
60 virtual bool perform(ExceptionCode&) = 0;
61
62 virtual bool undo(ExceptionCode&) = 0;
63 virtual bool redo(ExceptionCode&) = 0;
64
65 virtual bool isUndoableStateMark();
66 private:
67 String m_name;
68 };
69
70 InspectorHistory();
71 virtual ~InspectorHistory();
72
73 bool perform(PassOwnPtr<Action>, ExceptionCode&);
74 void markUndoableState();
75
76 bool undo(ExceptionCode&);
77 bool redo(ExceptionCode&);
78 void reset();
79
80 private:
81 Vector<OwnPtr<Action> > m_history;
82 size_t m_afterLastActionIndex;
83 }; 46 };
84 47
48 class V8PerContextDebugData {
49 public:
50 static bool setContextDebugData(v8::Handle<v8::Context>, const char* worldNa me, int debugId);
51 static int contextDebugId(v8::Handle<v8::Context>);
52 // returns 'page', 'injected', or 'worker'
53 static String contextCategory(v8::Handle<v8::Context> context);
54
55 static bool isSystemScope(v8::Handle<v8::Context>);
56
57 // Instances of this class mark a context as temporarily used by the System, for eg
58 // miscellaneous_bindings, console-defining initial injected script and devt ools
59 // command line evaluations, all within a page context
60 class SystemScope {
61 public:
62 SystemScope(v8::Handle<v8::Context>);
63 ~SystemScope();
64 bool matches(v8::Handle<v8::Context>);
65 private:
66 v8::Persistent<v8::Context> m_context;
67 friend class V8PerContextDebugData;
68 };
69 friend class SystemScope;
70 };
85 71
86 } // namespace WebCore 72 } // namespace WebCore
87 73
88 #endif // !defined(InspectorHistory_h) 74 #endif // V8PerContextDebugData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698