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

Side by Side Diff: sky/engine/bindings/core/v8/V8GCController.cpp

Issue 889823002: Remove TRACE_EVENT indirection through blink::Platform (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « sky/engine/bindings/core/v8/V8Binding.cpp ('k') | sky/engine/core/Init.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 30 matching lines...) Expand all
41 #include "sky/engine/bindings/core/v8/WrapperTypeInfo.h" 41 #include "sky/engine/bindings/core/v8/WrapperTypeInfo.h"
42 #include "sky/engine/core/dom/Attr.h" 42 #include "sky/engine/core/dom/Attr.h"
43 #include "sky/engine/core/dom/Document.h" 43 #include "sky/engine/core/dom/Document.h"
44 #include "sky/engine/core/dom/NodeTraversal.h" 44 #include "sky/engine/core/dom/NodeTraversal.h"
45 #include "sky/engine/core/dom/TemplateContentDocumentFragment.h" 45 #include "sky/engine/core/dom/TemplateContentDocumentFragment.h"
46 #include "sky/engine/core/dom/shadow/ElementShadow.h" 46 #include "sky/engine/core/dom/shadow/ElementShadow.h"
47 #include "sky/engine/core/dom/shadow/ShadowRoot.h" 47 #include "sky/engine/core/dom/shadow/ShadowRoot.h"
48 #include "sky/engine/core/html/HTMLImageElement.h" 48 #include "sky/engine/core/html/HTMLImageElement.h"
49 #include "sky/engine/core/html/HTMLTemplateElement.h" 49 #include "sky/engine/core/html/HTMLTemplateElement.h"
50 #include "sky/engine/core/html/imports/HTMLImportsController.h" 50 #include "sky/engine/core/html/imports/HTMLImportsController.h"
51 #include "sky/engine/core/inspector/InspectorTraceEvents.h"
52 #include "sky/engine/platform/Partitions.h" 51 #include "sky/engine/platform/Partitions.h"
53 #include "sky/engine/platform/TraceEvent.h" 52 #include "sky/engine/platform/TraceEvent.h"
54 #include "sky/engine/wtf/Vector.h" 53 #include "sky/engine/wtf/Vector.h"
55 54
56 namespace blink { 55 namespace blink {
57 56
58 // FIXME: This should use opaque GC roots. 57 // FIXME: This should use opaque GC roots.
59 static void addReferencesForNodeWithEventListeners(v8::Isolate* isolate, Node* n ode, const v8::Persistent<v8::Object>& wrapper) 58 static void addReferencesForNodeWithEventListeners(v8::Isolate* isolate, Node* n ode, const v8::Persistent<v8::Object>& wrapper)
60 { 59 {
61 ASSERT(node->hasEventListeners()); 60 ASSERT(node->hasEventListeners());
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 295 }
297 return id; 296 return id;
298 } 297 }
299 298
300 v8::Isolate* m_isolate; 299 v8::Isolate* m_isolate;
301 Vector<RawPtr<Node> > m_groupsWhichNeedRetainerInfo; 300 Vector<RawPtr<Node> > m_groupsWhichNeedRetainerInfo;
302 bool m_liveRootGroupIdSet; 301 bool m_liveRootGroupIdSet;
303 bool m_constructRetainedObjectInfos; 302 bool m_constructRetainedObjectInfos;
304 }; 303 };
305 304
306 static unsigned long long usedHeapSize(v8::Isolate* isolate)
307 {
308 v8::HeapStatistics heapStatistics;
309 isolate->GetHeapStatistics(&heapStatistics);
310 return heapStatistics.used_heap_size();
311 }
312
313 void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags) 305 void V8GCController::gcPrologue(v8::GCType type, v8::GCCallbackFlags flags)
314 { 306 {
315 // FIXME: It would be nice if the GC callbacks passed the Isolate directly.. .. 307 // FIXME: It would be nice if the GC callbacks passed the Isolate directly.. ..
316 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 308 v8::Isolate* isolate = v8::Isolate::GetCurrent();
317 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "GCEvent" , "usedHeapSizeBefore", usedHeapSize(isolate));
318 if (type == v8::kGCTypeScavenge) 309 if (type == v8::kGCTypeScavenge)
319 minorGCPrologue(isolate); 310 minorGCPrologue(isolate);
320 else if (type == v8::kGCTypeMarkSweepCompact) 311 else if (type == v8::kGCTypeMarkSweepCompact)
321 majorGCPrologue(flags & v8::kGCCallbackFlagConstructRetainedObjectInfos, isolate); 312 majorGCPrologue(flags & v8::kGCCallbackFlagConstructRetainedObjectInfos, isolate);
322 } 313 }
323 314
324 void V8GCController::minorGCPrologue(v8::Isolate* isolate) 315 void V8GCController::minorGCPrologue(v8::Isolate* isolate)
325 { 316 {
326 TRACE_EVENT_BEGIN0("v8", "minorGC"); 317 TRACE_EVENT_BEGIN0("v8", "minorGC");
327 if (isMainThread()) { 318 if (isMainThread()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 352 }
362 353
363 void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags) 354 void V8GCController::gcEpilogue(v8::GCType type, v8::GCCallbackFlags flags)
364 { 355 {
365 // FIXME: It would be nice if the GC callbacks passed the Isolate directly.. .. 356 // FIXME: It would be nice if the GC callbacks passed the Isolate directly.. ..
366 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 357 v8::Isolate* isolate = v8::Isolate::GetCurrent();
367 if (type == v8::kGCTypeScavenge) 358 if (type == v8::kGCTypeScavenge)
368 minorGCEpilogue(isolate); 359 minorGCEpilogue(isolate);
369 else if (type == v8::kGCTypeMarkSweepCompact) 360 else if (type == v8::kGCTypeMarkSweepCompact)
370 majorGCEpilogue(isolate); 361 majorGCEpilogue(isolate);
371
372 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "GCEvent", "usedHeapSizeAfter", usedHeapSize(isolate));
373 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data ());
374 } 362 }
375 363
376 void V8GCController::minorGCEpilogue(v8::Isolate* isolate) 364 void V8GCController::minorGCEpilogue(v8::Isolate* isolate)
377 { 365 {
378 TRACE_EVENT_END0("v8", "minorGC"); 366 TRACE_EVENT_END0("v8", "minorGC");
379 if (isMainThread()) 367 if (isMainThread())
380 ScriptForbiddenScope::exit(); 368 ScriptForbiddenScope::exit();
381 } 369 }
382 370
383 void V8GCController::majorGCEpilogue(v8::Isolate* isolate) 371 void V8GCController::majorGCEpilogue(v8::Isolate* isolate)
(...skipping 22 matching lines...) Expand all
406 static size_t lastUsageReportedToV8 = 0; 394 static size_t lastUsageReportedToV8 = 0;
407 395
408 size_t currentUsage = Partitions::currentDOMMemoryUsage(); 396 size_t currentUsage = Partitions::currentDOMMemoryUsage();
409 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las tUsageReportedToV8); 397 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las tUsageReportedToV8);
410 isolate->AdjustAmountOfExternalAllocatedMemory(diff); 398 isolate->AdjustAmountOfExternalAllocatedMemory(diff);
411 399
412 lastUsageReportedToV8 = currentUsage; 400 lastUsageReportedToV8 = currentUsage;
413 } 401 }
414 402
415 } // namespace blink 403 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/bindings/core/v8/V8Binding.cpp ('k') | sky/engine/core/Init.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698