| 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 23 matching lines...) Expand all Loading... |
| 34 #include "bindings/core/v8/RetainedDOMInfo.h" | 34 #include "bindings/core/v8/RetainedDOMInfo.h" |
| 35 #include "bindings/core/v8/ScriptWrappableVisitor.h" | 35 #include "bindings/core/v8/ScriptWrappableVisitor.h" |
| 36 #include "bindings/core/v8/V8AbstractEventListener.h" | 36 #include "bindings/core/v8/V8AbstractEventListener.h" |
| 37 #include "bindings/core/v8/V8Binding.h" | 37 #include "bindings/core/v8/V8Binding.h" |
| 38 #include "bindings/core/v8/V8Node.h" | 38 #include "bindings/core/v8/V8Node.h" |
| 39 #include "bindings/core/v8/V8ScriptRunner.h" | 39 #include "bindings/core/v8/V8ScriptRunner.h" |
| 40 #include "bindings/core/v8/WrapperTypeInfo.h" | 40 #include "bindings/core/v8/WrapperTypeInfo.h" |
| 41 #include "core/dom/Attr.h" | 41 #include "core/dom/Attr.h" |
| 42 #include "core/dom/Element.h" | 42 #include "core/dom/Element.h" |
| 43 #include "core/dom/Node.h" | 43 #include "core/dom/Node.h" |
| 44 #include "core/dom/shadow/ShadowRoot.h" |
| 44 #include "core/html/imports/HTMLImportsController.h" | 45 #include "core/html/imports/HTMLImportsController.h" |
| 45 #include "core/inspector/InspectorTraceEvents.h" | 46 #include "core/inspector/InspectorTraceEvents.h" |
| 46 #include "platform/Histogram.h" | 47 #include "platform/Histogram.h" |
| 47 #include "platform/RuntimeEnabledFeatures.h" | 48 #include "platform/RuntimeEnabledFeatures.h" |
| 48 #include "platform/tracing/TraceEvent.h" | 49 #include "platform/tracing/TraceEvent.h" |
| 49 #include "public/platform/BlameContext.h" | 50 #include "public/platform/BlameContext.h" |
| 50 #include "public/platform/Platform.h" | 51 #include "public/platform/Platform.h" |
| 51 #include "wtf/Vector.h" | 52 #include "wtf/Vector.h" |
| 52 #include "wtf/allocator/Partitions.h" | 53 #include "wtf/allocator/Partitions.h" |
| 53 #include <algorithm> | 54 #include <algorithm> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return &document; | 86 return &document; |
| 86 } | 87 } |
| 87 | 88 |
| 88 if (node->isAttributeNode()) { | 89 if (node->isAttributeNode()) { |
| 89 Node* ownerElement = toAttr(node)->ownerElement(); | 90 Node* ownerElement = toAttr(node)->ownerElement(); |
| 90 if (!ownerElement) | 91 if (!ownerElement) |
| 91 return node; | 92 return node; |
| 92 node = ownerElement; | 93 node = ownerElement; |
| 93 } | 94 } |
| 94 | 95 |
| 96 // Node -> Host (if any) is O(1) |
| 97 while (node->isInShadowTree()) |
| 98 node = &node->containingShadowRoot()->host(); |
| 99 |
| 100 // The "ShadowHost" part is redundant because of the isInShadowTree |
| 101 // loop, but this is still preferable because parent/shadow host |
| 102 // pointer occupies the same space. |
| 95 while (Node* parent = node->parentOrShadowHostOrTemplateHostNode()) | 103 while (Node* parent = node->parentOrShadowHostOrTemplateHostNode()) |
| 96 node = parent; | 104 node = parent; |
| 97 | 105 |
| 98 return node; | 106 return node; |
| 99 } | 107 } |
| 100 | 108 |
| 101 class MinorGCUnmodifiedWrapperVisitor : public v8::PersistentHandleVisitor { | 109 class MinorGCUnmodifiedWrapperVisitor : public v8::PersistentHandleVisitor { |
| 102 public: | 110 public: |
| 103 explicit MinorGCUnmodifiedWrapperVisitor(v8::Isolate* isolate) | 111 explicit MinorGCUnmodifiedWrapperVisitor(v8::Isolate* isolate) |
| 104 : m_isolate(isolate) {} | 112 : m_isolate(isolate) {} |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 double startTime = WTF::currentTimeMS(); | 551 double startTime = WTF::currentTimeMS(); |
| 544 v8::HandleScope scope(isolate); | 552 v8::HandleScope scope(isolate); |
| 545 PendingActivityVisitor visitor(isolate, executionContext); | 553 PendingActivityVisitor visitor(isolate, executionContext); |
| 546 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); | 554 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); |
| 547 scanPendingActivityHistogram.count( | 555 scanPendingActivityHistogram.count( |
| 548 static_cast<int>(WTF::currentTimeMS() - startTime)); | 556 static_cast<int>(WTF::currentTimeMS() - startTime)); |
| 549 return visitor.pendingActivityFound(); | 557 return visitor.pendingActivityFound(); |
| 550 } | 558 } |
| 551 | 559 |
| 552 } // namespace blink | 560 } // namespace blink |
| OLD | NEW |