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

Side by Side Diff: Source/WebCore/bindings/dart/DartIsolateState.cpp

Issue 9260001: Instrumentations to trace Swarm startup. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 8 years, 11 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
« no previous file with comments | « Source/WebCore/bindings/dart/DartController.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011, Google Inc. 1 // Copyright 2011, Google Inc.
2 // All rights reserved. 2 // 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 15 matching lines...) Expand all
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 #include "config.h" 30 #include "config.h"
31 #include "DartIsolateState.h" 31 #include "DartIsolateState.h"
32 32
33 #include "DartController.h" 33 #include "DartController.h"
34 #include "DartDOMWrapper.h" 34 #include "DartDOMWrapper.h"
35 #include "DartUtilities.h" 35 #include "DartUtilities.h"
36 #include "InspectorInstrumentation.h"
36 37
37 namespace WebCore { 38 namespace WebCore {
38 39
39 struct DartIsolateLink { 40 struct DartIsolateLink {
40 DartIsolateLink(Dart_Isolate isolate, DartIsolateLink* previous) 41 DartIsolateLink(Dart_Isolate isolate, DartIsolateLink* previous)
41 : isolate(isolate), previous(previous) {} 42 : isolate(isolate), previous(previous) {}
42 43
43 Dart_Isolate isolate; 44 Dart_Isolate isolate;
44 DartIsolateLink* previous; 45 DartIsolateLink* previous;
45 }; 46 };
46 47
47 DartIsolateLink* DartIsolateState::m_current = 0; 48 DartIsolateLink* DartIsolateState::m_current = 0;
48 49
49 void DartIsolateState::pushLink(Dart_Isolate isolate) 50 void DartIsolateState::pushLink(Dart_Isolate isolate)
50 { 51 {
51 m_current = new DartIsolateLink(isolate, m_current); 52 m_current = new DartIsolateLink(isolate, m_current);
52 } 53 }
53 54
54 void DartIsolateState::popLink() 55 void DartIsolateState::popLink()
55 { 56 {
56 DartIsolateLink* previous = m_current->previous; 57 DartIsolateLink* previous = m_current->previous;
57 delete m_current; 58 delete m_current;
58 m_current = previous; 59 m_current = previous;
59 } 60 }
60 61
62 class Timeline {
63 public:
64 Timeline(Frame* frame, String tag)
65 {
66 m_cookie = InspectorInstrumentation::willEvaluateScript(frame, tag, 0);
67 }
68
69 ~Timeline()
70 {
71 InspectorInstrumentation::didEvaluateScript(m_cookie);
72 }
73
74 private:
75 InspectorInstrumentationCookie m_cookie;
76 };
77
78
61 // Creates a new isolates and sets it as the current. 79 // Creates a new isolates and sets it as the current.
62 Dart_Isolate DartIsolateState::create(ScriptExecutionContext* context, void* dat a) 80 Dart_Isolate DartIsolateState::create(ScriptExecutionContext* context, void* dat a)
63 { 81 {
82 Frame* f = static_cast<Document*>(context)->frame();
64 if (m_current) { 83 if (m_current) {
65 ASSERT(m_current->isolate && m_current->isolate == Dart_CurrentIsolate() ); 84 ASSERT(m_current->isolate && m_current->isolate == Dart_CurrentIsolate() );
66 Dart_ExitIsolate(); 85 Dart_ExitIsolate();
67 } 86 }
68 // FIXME: proper error reporting. 87 // FIXME: proper error reporting.
69 char* errorMsg = 0; 88 char* errorMsg = 0;
70 ASSERT(data); 89 ASSERT(data);
71 Dart_Isolate isolate = Dart_CreateIsolate(DartUtilities::fullSnapshot(), dat a, &errorMsg); 90 Dart_Isolate isolate;
91 {
92 Timeline t0(f, "Dart_CreateIsolate");
93 isolate = Dart_CreateIsolate(DartUtilities::fullSnapshot(), data, &errorMsg) ;
94 }
72 pushLink(isolate); 95 pushLink(isolate);
73 ASSERT(Dart_CurrentIsolate() == isolate); 96 ASSERT(Dart_CurrentIsolate() == isolate);
74 DartController::setupDOMEnabledIsolate(context); 97 DartController::setupDOMEnabledIsolate(context);
75 return isolate; 98 return isolate;
76 } 99 }
77 100
78 // Push the given isolate as the current one. 101 // Push the given isolate as the current one.
79 void DartIsolateState::push(Dart_Isolate isolate) 102 void DartIsolateState::push(Dart_Isolate isolate)
80 { 103 {
81 if (m_current) { 104 if (m_current) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (m_current) 154 if (m_current)
132 Dart_ExitIsolate(); 155 Dart_ExitIsolate();
133 Dart_EnterIsolate(isolate); 156 Dart_EnterIsolate(isolate);
134 Dart_ShutdownIsolate(); 157 Dart_ShutdownIsolate();
135 DartUtilities::unregisterIsolateContext(isolate); 158 DartUtilities::unregisterIsolateContext(isolate);
136 if (m_current) 159 if (m_current)
137 Dart_EnterIsolate(m_current->isolate); 160 Dart_EnterIsolate(m_current->isolate);
138 } 161 }
139 162
140 } 163 }
OLDNEW
« no previous file with comments | « Source/WebCore/bindings/dart/DartController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698