Commit edf3637b authored by Fernando Serboncini's avatar Fernando Serboncini Committed by Commit Bot

Use FastMallocPartition for BidiCharacterRun

Previously, BidiCharacterRun used LayoutPartition, which is not thread
safe. GIven that now OffscreenCanvas can render text in a thread, those
runs need to be allocated/deleted from different threads.

Tested performance was neutral.

Bug: 799362
Change-Id: Id8766e23d4be1a41effeeb8956fa1b3e06dc49a3
Reviewed-on: https://chromium-review.googlesource.com/953331
Commit-Queue: Fernando Serboncini <fserb@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541858}
parent be008175
......@@ -1378,7 +1378,6 @@ jumbo_component("platform") {
"speech/PlatformSpeechSynthesisVoice.h",
"speech/PlatformSpeechSynthesizer.cpp",
"speech/PlatformSpeechSynthesizer.h",
"text/BidiCharacterRun.cpp",
"text/BidiCharacterRun.h",
"text/BidiContext.cpp",
"text/BidiContext.h",
......
/**
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include "platform/text/BidiCharacterRun.h"
#include "platform/wtf/allocator/Partitions.h"
namespace blink {
void* BidiCharacterRun::operator new(size_t sz) {
return WTF::Partitions::LayoutPartition()->Alloc(
sz, WTF_HEAP_PROFILER_TYPE_NAME(BidiCharacterRun));
}
void BidiCharacterRun::operator delete(void* ptr) {
WTF::PartitionFree(ptr);
}
} // namespace blink
......@@ -28,6 +28,9 @@
namespace blink {
struct BidiCharacterRun {
USING_FAST_MALLOC(BidiCharacterRun);
public:
BidiCharacterRun(bool override,
unsigned char level,
int start,
......@@ -67,10 +70,6 @@ struct BidiCharacterRun {
start_(start),
stop_(stop) {}
// BidiCharacterRun are allocated out of the rendering partition.
PLATFORM_EXPORT void* operator new(size_t);
PLATFORM_EXPORT void operator delete(void*);
int Start() const { return start_; }
int Stop() const { return stop_; }
unsigned char Level() const { return level_; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment