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

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

Issue 638813002: Replace FINAL and OVERRIDE with their C++11 counterparts in Source/bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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) 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 // Regarding a minor GC algorithm for DOM nodes, see this document: 103 // Regarding a minor GC algorithm for DOM nodes, see this document:
104 // https://docs.google.com/a/google.com/presentation/d/1uifwVYGNYTZDoGLyCb7sXa7g 49mWNMW2gaWvMN5NLk8/edit#slide=id.p 104 // https://docs.google.com/a/google.com/presentation/d/1uifwVYGNYTZDoGLyCb7sXa7g 49mWNMW2gaWvMN5NLk8/edit#slide=id.p
105 class MinorGCWrapperVisitor : public v8::PersistentHandleVisitor { 105 class MinorGCWrapperVisitor : public v8::PersistentHandleVisitor {
106 public: 106 public:
107 explicit MinorGCWrapperVisitor(v8::Isolate* isolate) 107 explicit MinorGCWrapperVisitor(v8::Isolate* isolate)
108 : m_isolate(isolate) 108 : m_isolate(isolate)
109 { } 109 { }
110 110
111 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_ t classId) OVERRIDE 111 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_ t classId) override
112 { 112 {
113 // A minor DOM GC can collect only Nodes. 113 // A minor DOM GC can collect only Nodes.
114 if (classId != WrapperTypeInfo::NodeClassId) 114 if (classId != WrapperTypeInfo::NodeClassId)
115 return; 115 return;
116 116
117 // To make minor GC cycle time bounded, we limit the number of wrappers handled 117 // To make minor GC cycle time bounded, we limit the number of wrappers handled
118 // by each minor GC cycle to 10000. This value was selected so that the minor 118 // by each minor GC cycle to 10000. This value was selected so that the minor
119 // GC cycle time is bounded to 20 ms in a case where the new space size 119 // GC cycle time is bounded to 20 ms in a case where the new space size
120 // is 16 MB and it is full of wrappers (which is almost the worst case). 120 // is 16 MB and it is full of wrappers (which is almost the worst case).
121 // Practically speaking, as far as I crawled real web applications, 121 // Practically speaking, as far as I crawled real web applications,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor { 246 class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor {
247 public: 247 public:
248 explicit MajorGCWrapperVisitor(v8::Isolate* isolate, bool constructRetainedO bjectInfos) 248 explicit MajorGCWrapperVisitor(v8::Isolate* isolate, bool constructRetainedO bjectInfos)
249 : m_isolate(isolate) 249 : m_isolate(isolate)
250 , m_liveRootGroupIdSet(false) 250 , m_liveRootGroupIdSet(false)
251 , m_constructRetainedObjectInfos(constructRetainedObjectInfos) 251 , m_constructRetainedObjectInfos(constructRetainedObjectInfos)
252 { 252 {
253 } 253 }
254 254
255 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_ t classId) OVERRIDE 255 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_ t classId) override
256 { 256 {
257 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf o::ObjectClassId) 257 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf o::ObjectClassId)
258 return; 258 return;
259 259
260 // Casting to a Handle is safe here, since the Persistent doesn't get GC d 260 // Casting to a Handle is safe here, since the Persistent doesn't get GC d
261 // during the GC prologue. 261 // during the GC prologue.
262 ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject()); 262 ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject());
263 v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object >*>(value); 263 v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object >*>(value);
264 ASSERT(V8DOMWrapper::isDOMWrapper(*wrapper)); 264 ASSERT(V8DOMWrapper::isDOMWrapper(*wrapper));
265 265
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 static size_t lastUsageReportedToV8 = 0; 450 static size_t lastUsageReportedToV8 = 0;
451 451
452 size_t currentUsage = Partitions::currentDOMMemoryUsage(); 452 size_t currentUsage = Partitions::currentDOMMemoryUsage();
453 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las tUsageReportedToV8); 453 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las tUsageReportedToV8);
454 isolate->AdjustAmountOfExternalAllocatedMemory(diff); 454 isolate->AdjustAmountOfExternalAllocatedMemory(diff);
455 455
456 lastUsageReportedToV8 = currentUsage; 456 lastUsageReportedToV8 = currentUsage;
457 } 457 }
458 458
459 } // namespace blink 459 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8EventListener.h ('k') | Source/bindings/core/v8/V8LazyEventListener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698