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

Side by Side Diff: Source/WebCore/bindings/dart/DartController.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
OLDNEW
1 // Copyright (c) 2009, Google Inc. 1 // Copyright (c) 2009, 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 26 matching lines...) Expand all
37 #include "DartClassInfo.h" 37 #include "DartClassInfo.h"
38 #include "DartDOMWindow.h" 38 #include "DartDOMWindow.h"
39 #include "DartDOMWrapper.h" 39 #include "DartDOMWrapper.h"
40 #include "DartIsolateState.h" 40 #include "DartIsolateState.h"
41 #include "DartUtilities.h" 41 #include "DartUtilities.h"
42 #include "Document.h" 42 #include "Document.h"
43 #include "Frame.h" 43 #include "Frame.h"
44 #include "HTMLNames.h" 44 #include "HTMLNames.h"
45 #include "HTMLScriptElement.h" 45 #include "HTMLScriptElement.h"
46 #include "IDBPendingTransactionMonitor.h" 46 #include "IDBPendingTransactionMonitor.h"
47 #include "InspectorInstrumentation.h"
47 #include "NodeList.h" 48 #include "NodeList.h"
48 #include "Page.h" 49 #include "Page.h"
49 #include "PageGroup.h" 50 #include "PageGroup.h"
50 #include "ScheduledAction.h" 51 #include "ScheduledAction.h"
51 #include "ScriptExecutionContext.h" 52 #include "ScriptExecutionContext.h"
52 #include "Settings.h" 53 #include "Settings.h"
53 #include "StorageNamespace.h" 54 #include "StorageNamespace.h"
54 55
55 #include "npruntime_impl.h" 56 #include "npruntime_impl.h"
56 #include <bindings/npruntime.h> 57 #include <bindings/npruntime.h>
57 58
58 namespace WebCore { 59 namespace WebCore {
59 60
61 class Timeline {
62 public:
63 Timeline(Frame* frame, String tag)
64 {
65 m_cookie = InspectorInstrumentation::willEvaluateScript(frame, tag, 0);
66 }
67
68 ~Timeline()
69 {
70 InspectorInstrumentation::didEvaluateScript(m_cookie);
71 }
72
73 private:
74 InspectorInstrumentationCookie m_cookie;
75 };
76
60 static void initDOMIsolate() 77 static void initDOMIsolate()
61 { 78 {
62 DartApiScope dartApiScope; 79 DartApiScope dartApiScope;
63 80
64 // Fix the dom library. 81 // Fix the dom library.
65 Dart_Handle dom = Dart_LookupLibrary(Dart_NewString(DartUtilities::domLibrar yName)); 82 Dart_Handle dom = Dart_LookupLibrary(Dart_NewString(DartUtilities::domLibrar yName));
66 83
67 // Inject builtin library to forward core functionality to dom. 84 // Inject builtin library to forward core functionality to dom.
68 // FIXME: We need to provide something for non-DOM isolates as well. 85 // FIXME: We need to provide something for non-DOM isolates as well.
69 Dart_Handle core = Dart_LookupLibrary(Dart_NewString("dart:core")); 86 Dart_Handle core = Dart_LookupLibrary(Dart_NewString("dart:core"));
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 if (document->readyState() == "loading") 275 if (document->readyState() == "loading")
259 document->domWindow()->addEventListener(String("DOMContentLoaded"), DartScriptRunner::create(), false); 276 document->domWindow()->addEventListener(String("DOMContentLoaded"), DartScriptRunner::create(), false);
260 else 277 else
261 loadScripts(); 278 loadScripts();
262 } 279 }
263 } 280 }
264 281
265 282
266 void DartController::loadScripts() 283 void DartController::loadScripts()
267 { 284 {
285 Timeline timeline(frame(), "DC::loadScripts");
268 initVMIfNeeded(); 286 initVMIfNeeded();
269 287
270 Vector<RefPtr<HTMLScriptElement> > dartScripts; 288 Vector<RefPtr<HTMLScriptElement> > dartScripts;
271 RefPtr<NodeList> scripts = m_frame->document()->getElementsByTagName("script "); 289 RefPtr<NodeList> scripts = m_frame->document()->getElementsByTagName("script ");
272 for (unsigned i = 0; i < scripts->length(); ++i) { 290 for (unsigned i = 0; i < scripts->length(); ++i) {
273 Node* scriptNode = scripts->item(i); 291 Node* scriptNode = scripts->item(i);
274 HTMLScriptElement* scriptElement = static_cast<HTMLScriptElement*>(scrip tNode); 292 HTMLScriptElement* scriptElement = static_cast<HTMLScriptElement*>(scrip tNode);
275 String typeAttr = scriptElement->getAttribute(HTMLNames::typeAttr).strin g(); 293 String typeAttr = scriptElement->getAttribute(HTMLNames::typeAttr).strin g();
276 if (isDartMimeType(typeAttr.stripWhiteSpace().lower())) 294 if (isDartMimeType(typeAttr.stripWhiteSpace().lower()))
277 dartScripts.append(scriptElement); 295 dartScripts.append(scriptElement);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 427 }
410 428
411 DartController* DartController::retrieve(ScriptExecutionContext* context) 429 DartController* DartController::retrieve(ScriptExecutionContext* context)
412 { 430 {
413 if (!context || !context->isDocument()) 431 if (!context || !context->isDocument())
414 return 0; 432 return 0;
415 return retrieve(static_cast<Document*>(context)->frame()); 433 return retrieve(static_cast<Document*>(context)->frame());
416 } 434 }
417 435
418 } 436 }
OLDNEW
« no previous file with comments | « Source/WebCore/bindings/dart/DartApplicationLoader.cpp ('k') | Source/WebCore/bindings/dart/DartIsolateState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698