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

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

Issue 1236473002: Fix virtual/override/final usage in Source/bindings/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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/bindings/core/v8/V8EventListener.h ('k') | Source/bindings/core/v8/V8Initializer.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 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 void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_t classI d) 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor { 243 class MajorGCWrapperVisitor : public v8::PersistentHandleVisitor {
244 public: 244 public:
245 explicit MajorGCWrapperVisitor(v8::Isolate* isolate, bool constructRetainedO bjectInfos) 245 explicit MajorGCWrapperVisitor(v8::Isolate* isolate, bool constructRetainedO bjectInfos)
246 : m_isolate(isolate) 246 : m_isolate(isolate)
247 , m_domObjectsWithPendingActivity(0) 247 , m_domObjectsWithPendingActivity(0)
248 , m_liveRootGroupIdSet(false) 248 , m_liveRootGroupIdSet(false)
249 , m_constructRetainedObjectInfos(constructRetainedObjectInfos) 249 , m_constructRetainedObjectInfos(constructRetainedObjectInfos)
250 { 250 {
251 } 251 }
252 252
253 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_ t classId) override 253 void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_t classI d) override
254 { 254 {
255 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf o::ObjectClassId) 255 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf o::ObjectClassId)
256 return; 256 return;
257 257
258 v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8 ::Persistent<v8::Object>::Cast(*value)); 258 v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(m_isolate, v8 ::Persistent<v8::Object>::Cast(*value));
259 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper)); 259 ASSERT(V8DOMWrapper::hasInternalFieldsSet(wrapper));
260 260
261 if (value->IsIndependent()) 261 if (value->IsIndependent())
262 return; 262 return;
263 263
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 lastUsageReportedToV8 = currentUsage; 479 lastUsageReportedToV8 = currentUsage;
480 } 480 }
481 481
482 class DOMWrapperTracer : public v8::PersistentHandleVisitor { 482 class DOMWrapperTracer : public v8::PersistentHandleVisitor {
483 public: 483 public:
484 explicit DOMWrapperTracer(Visitor* visitor) 484 explicit DOMWrapperTracer(Visitor* visitor)
485 : m_visitor(visitor) 485 : m_visitor(visitor)
486 { 486 {
487 } 487 }
488 488
489 virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_ t classId) override 489 void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_t classI d) override
490 { 490 {
491 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf o::ObjectClassId) 491 if (classId != WrapperTypeInfo::NodeClassId && classId != WrapperTypeInf o::ObjectClassId)
492 return; 492 return;
493 493
494 const v8::Persistent<v8::Object>& wrapper = v8::Persistent<v8::Object>:: Cast(*value); 494 const v8::Persistent<v8::Object>& wrapper = v8::Persistent<v8::Object>:: Cast(*value);
495 495
496 if (m_visitor) 496 if (m_visitor)
497 toWrapperTypeInfo(wrapper)->trace(m_visitor, toScriptWrappable(wrapp er)); 497 toWrapperTypeInfo(wrapper)->trace(m_visitor, toScriptWrappable(wrapp er));
498 } 498 }
499 499
500 private: 500 private:
501 Visitor* m_visitor; 501 Visitor* m_visitor;
502 }; 502 };
503 503
504 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) 504 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor)
505 { 505 {
506 DOMWrapperTracer tracer(visitor); 506 DOMWrapperTracer tracer(visitor);
507 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); 507 v8::V8::VisitHandlesWithClassIds(isolate, &tracer);
508 } 508 }
509 509
510 } // namespace blink 510 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8EventListener.h ('k') | Source/bindings/core/v8/V8Initializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698