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

Side by Side Diff: Source/bindings/core/v8/V8GCController.cpp

Issue 1041103002: PartitionAlloc: Centralize Partition allocators into one place (Part 1) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/Init.cpp » ('j') | Source/wtf/Partitions.h » ('J')
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/dom/Document.h" 42 #include "core/dom/Document.h"
43 #include "core/dom/NodeTraversal.h" 43 #include "core/dom/NodeTraversal.h"
44 #include "core/dom/TemplateContentDocumentFragment.h" 44 #include "core/dom/TemplateContentDocumentFragment.h"
45 #include "core/dom/shadow/ElementShadow.h" 45 #include "core/dom/shadow/ElementShadow.h"
46 #include "core/dom/shadow/ShadowRoot.h" 46 #include "core/dom/shadow/ShadowRoot.h"
47 #include "core/html/HTMLImageElement.h" 47 #include "core/html/HTMLImageElement.h"
48 #include "core/html/HTMLTemplateElement.h" 48 #include "core/html/HTMLTemplateElement.h"
49 #include "core/html/imports/HTMLImportsController.h" 49 #include "core/html/imports/HTMLImportsController.h"
50 #include "core/inspector/InspectorTraceEvents.h" 50 #include "core/inspector/InspectorTraceEvents.h"
51 #include "core/svg/SVGElement.h" 51 #include "core/svg/SVGElement.h"
52 #include "platform/Partitions.h"
53 #include "platform/TraceEvent.h" 52 #include "platform/TraceEvent.h"
53 #include "wtf/Partitions.h"
54 #include "wtf/Vector.h" 54 #include "wtf/Vector.h"
55 #include <algorithm> 55 #include <algorithm>
56 56
57 namespace blink { 57 namespace blink {
58 58
59 // FIXME: This should use opaque GC roots. 59 // FIXME: This should use opaque GC roots.
60 static void addReferencesForNodeWithEventListeners(v8::Isolate* isolate, Node* n ode, const v8::Persistent<v8::Object>& wrapper) 60 static void addReferencesForNodeWithEventListeners(v8::Isolate* isolate, Node* n ode, const v8::Persistent<v8::Object>& wrapper)
61 { 61 {
62 ASSERT(node->hasEventListeners()); 62 ASSERT(node->hasEventListeners());
63 63
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 scriptState->disposePerContextData(); 468 scriptState->disposePerContextData();
469 } 469 }
470 470
471 void V8GCController::reportDOMMemoryUsageToV8(v8::Isolate* isolate) 471 void V8GCController::reportDOMMemoryUsageToV8(v8::Isolate* isolate)
472 { 472 {
473 if (!isMainThread()) 473 if (!isMainThread())
474 return; 474 return;
475 475
476 static size_t lastUsageReportedToV8 = 0; 476 static size_t lastUsageReportedToV8 = 0;
477 477
478 size_t currentUsage = Partitions::currentDOMMemoryUsage(); 478 size_t currentUsage = WTF::Partitions::currentDOMMemoryUsage();
479 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las tUsageReportedToV8); 479 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las tUsageReportedToV8);
480 isolate->AdjustAmountOfExternalAllocatedMemory(diff); 480 isolate->AdjustAmountOfExternalAllocatedMemory(diff);
481 481
482 lastUsageReportedToV8 = currentUsage; 482 lastUsageReportedToV8 = currentUsage;
483 } 483 }
484 484
485 class DOMWrapperTracer : public v8::PersistentHandleVisitor { 485 class DOMWrapperTracer : public v8::PersistentHandleVisitor {
486 public: 486 public:
487 explicit DOMWrapperTracer(Visitor* visitor) 487 explicit DOMWrapperTracer(Visitor* visitor)
488 : m_visitor(visitor) 488 : m_visitor(visitor)
(...skipping 18 matching lines...) Expand all
507 Visitor* m_visitor; 507 Visitor* m_visitor;
508 }; 508 };
509 509
510 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) 510 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor)
511 { 511 {
512 DOMWrapperTracer tracer(visitor); 512 DOMWrapperTracer tracer(visitor);
513 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); 513 v8::V8::VisitHandlesWithClassIds(isolate, &tracer);
514 } 514 }
515 515
516 } // namespace blink 516 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/Init.cpp » ('j') | Source/wtf/Partitions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698