OLD | NEW |
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // The same special handling is in V8GCController::gcTree(). | 77 // The same special handling is in V8GCController::gcTree(). |
78 // Maybe should image elements be active DOM nodes? | 78 // Maybe should image elements be active DOM nodes? |
79 // See https://code.google.com/p/chromium/issues/detail?id=164882 | 79 // See https://code.google.com/p/chromium/issues/detail?id=164882 |
80 if (node->inDocument() || (isHTMLImageElement(*node) && toHTMLImageElement(*
node).hasPendingActivity())) { | 80 if (node->inDocument() || (isHTMLImageElement(*node) && toHTMLImageElement(*
node).hasPendingActivity())) { |
81 Document& document = node->document(); | 81 Document& document = node->document(); |
82 if (HTMLImportsController* controller = document.importsController()) | 82 if (HTMLImportsController* controller = document.importsController()) |
83 return controller->master(); | 83 return controller->master(); |
84 return &document; | 84 return &document; |
85 } | 85 } |
86 | 86 |
87 if (node->isAttributeNode()) { | |
88 Node* ownerElement = toAttr(node)->ownerElement(); | |
89 if (!ownerElement) | |
90 return node; | |
91 node = ownerElement; | |
92 } | |
93 | |
94 while (Node* parent = node->parentOrShadowHostOrTemplateHostNode()) | 87 while (Node* parent = node->parentOrShadowHostOrTemplateHostNode()) |
95 node = parent; | 88 node = parent; |
96 | 89 |
97 return node; | 90 return node; |
98 } | 91 } |
99 | 92 |
100 // Regarding a minor GC algorithm for DOM nodes, see this document: | 93 // Regarding a minor GC algorithm for DOM nodes, see this document: |
101 // https://docs.google.com/a/google.com/presentation/d/1uifwVYGNYTZDoGLyCb7sXa7g
49mWNMW2gaWvMN5NLk8/edit#slide=id.p | 94 // https://docs.google.com/a/google.com/presentation/d/1uifwVYGNYTZDoGLyCb7sXa7g
49mWNMW2gaWvMN5NLk8/edit#slide=id.p |
102 class MinorGCWrapperVisitor : public v8::PersistentHandleVisitor { | 95 class MinorGCWrapperVisitor : public v8::PersistentHandleVisitor { |
103 public: | 96 public: |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 static size_t lastUsageReportedToV8 = 0; | 411 static size_t lastUsageReportedToV8 = 0; |
419 | 412 |
420 size_t currentUsage = Partitions::currentDOMMemoryUsage(); | 413 size_t currentUsage = Partitions::currentDOMMemoryUsage(); |
421 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las
tUsageReportedToV8); | 414 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las
tUsageReportedToV8); |
422 isolate->AdjustAmountOfExternalAllocatedMemory(diff); | 415 isolate->AdjustAmountOfExternalAllocatedMemory(diff); |
423 | 416 |
424 lastUsageReportedToV8 = currentUsage; | 417 lastUsageReportedToV8 = currentUsage; |
425 } | 418 } |
426 | 419 |
427 } // namespace blink | 420 } // namespace blink |
OLD | NEW |