Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 #include "core/rendering/RenderText.h" | 37 #include "core/rendering/RenderText.h" |
| 38 #include "core/rendering/svg/RenderSVGInlineText.h" | 38 #include "core/rendering/svg/RenderSVGInlineText.h" |
| 39 #include "core/svg/SVGForeignObjectElement.h" | 39 #include "core/svg/SVGForeignObjectElement.h" |
| 40 #include "wtf/text/CString.h" | 40 #include "wtf/text/CString.h" |
| 41 #include "wtf/text/StringBuilder.h" | 41 #include "wtf/text/StringBuilder.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 PassRefPtrWillBeRawPtr<Text> Text::create(Document& document, const String& data ) | 45 PassRefPtrWillBeRawPtr<Text> Text::create(Document& document, const String& data ) |
| 46 { | 46 { |
| 47 #if ENABLE(OILPAN) | |
| 48 size_t length = data.length(); | |
| 49 if (length > 48) | |
| 50 Heap::increaseExternallyAllocatedBytes(length); | |
|
haraken
2015/02/10 01:23:17
Would it be possible to use these memory APIs in P
sof
2015/02/11 15:58:25
PartitionAlloc would have to know that it was an O
| |
| 51 #endif | |
| 47 return adoptRefWillBeNoop(new Text(document, data, CreateText)); | 52 return adoptRefWillBeNoop(new Text(document, data, CreateText)); |
| 48 } | 53 } |
| 49 | 54 |
| 50 PassRefPtrWillBeRawPtr<Text> Text::createEditingText(Document& document, const S tring& data) | 55 PassRefPtrWillBeRawPtr<Text> Text::createEditingText(Document& document, const S tring& data) |
| 51 { | 56 { |
| 52 return adoptRefWillBeNoop(new Text(document, data, CreateEditingText)); | 57 return adoptRefWillBeNoop(new Text(document, data, CreateEditingText)); |
| 53 } | 58 } |
| 54 | 59 |
| 55 PassRefPtrWillBeRawPtr<Node> Text::mergeNextSiblingNodesIfPossible() | 60 PassRefPtrWillBeRawPtr<Node> Text::mergeNextSiblingNodesIfPossible() |
| 56 { | 61 { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 return; | 406 return; |
| 402 } | 407 } |
| 403 textRenderer->setTextWithOffset(dataImpl(), offsetOfReplacedData, lengthOfRe placedData); | 408 textRenderer->setTextWithOffset(dataImpl(), offsetOfReplacedData, lengthOfRe placedData); |
| 404 } | 409 } |
| 405 | 410 |
| 406 PassRefPtrWillBeRawPtr<Text> Text::cloneWithData(const String& data) | 411 PassRefPtrWillBeRawPtr<Text> Text::cloneWithData(const String& data) |
| 407 { | 412 { |
| 408 return create(document(), data); | 413 return create(document(), data); |
| 409 } | 414 } |
| 410 | 415 |
| 416 void Text::trace(Visitor* visitor) | |
| 417 { | |
| 418 size_t length = m_data.length(); | |
| 419 if (length > 48) | |
| 420 Heap::increaseExternallyAllocatedBytesAlive(length); | |
|
haraken
2015/02/10 01:23:17
It looks dangerous to call increaseExternallyAlloc
sof
2015/02/11 15:58:25
As is, re-up'ing the allocation during tracing can
| |
| 421 | |
| 422 CharacterData::trace(visitor); | |
| 423 } | |
| 424 | |
| 411 #ifndef NDEBUG | 425 #ifndef NDEBUG |
| 412 void Text::formatForDebugger(char *buffer, unsigned length) const | 426 void Text::formatForDebugger(char *buffer, unsigned length) const |
| 413 { | 427 { |
| 414 StringBuilder result; | 428 StringBuilder result; |
| 415 String s; | 429 String s; |
| 416 | 430 |
| 417 result.append(nodeName()); | 431 result.append(nodeName()); |
| 418 | 432 |
| 419 s = data(); | 433 s = data(); |
| 420 if (s.length() > 0) { | 434 if (s.length() > 0) { |
| 421 if (result.length()) | 435 if (result.length()) |
| 422 result.appendLiteral("; "); | 436 result.appendLiteral("; "); |
| 423 result.appendLiteral("value="); | 437 result.appendLiteral("value="); |
| 424 result.append(s); | 438 result.append(s); |
| 425 } | 439 } |
| 426 | 440 |
| 427 strncpy(buffer, result.toString().utf8().data(), length - 1); | 441 strncpy(buffer, result.toString().utf8().data(), length - 1); |
| 428 } | 442 } |
| 429 #endif | 443 #endif |
| 430 | 444 |
| 431 } // namespace blink | 445 } // namespace blink |
| OLD | NEW |