Commit 86e4ed30 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

BlinkMemoryMgt: Annotate DatabaseVersionCache and SQLiteFileSystem classes...

BlinkMemoryMgt: Annotate DatabaseVersionCache and SQLiteFileSystem classes with the macros of Allocator

The OnionSoup effort has a goal of allocating all garbage-collectible Blink objects
with Oilpan or PartitionAlloc. However, some classes of
//blink/renderer/modules/webdatagbase have not yet been allocated with them so far.
So their uses of non-garbage-collected objects should be restricted to cases where
the garbage collector can discover their references. The macros of Allocator will be
useful for the non-garbage-collected objects to avoid unintended allocations.

After some analyzes, it was concluded that for the case of SQLiteFileSystem class, it
makes sense to use STATIC_ONLY because it only has static functions. To annotate
SQLiteFileSystem class with STATIC_ONLY, this CL removes the default constructor.

In DatabaseVersionCache class case, it makes sense to use USING_FAST_MALLOC because
it's used by DEFINE_THREAD_SAFE_STATIC_LOCAL macro.

Additionally, this CL annotates DOMWebSocketTestScope with STACK_ALLOCATED.

Bug: 919389
Change-Id: Iaad117a1edf152bee6dbe43b2979aaee5ca4ce0d
Reviewed-on: https://chromium-review.googlesource.com/c/1491070Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#635940}
parent a6d9cfda
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "third_party/blink/renderer/modules/webdatabase/storage_log.h" #include "third_party/blink/renderer/modules/webdatabase/storage_log.h"
#include "third_party/blink/renderer/platform/cross_thread_functional.h" #include "third_party/blink/renderer/platform/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
// Registering "opened" databases with the DatabaseTracker // Registering "opened" databases with the DatabaseTracker
// ======================================================= // =======================================================
...@@ -90,6 +91,8 @@ namespace { ...@@ -90,6 +91,8 @@ namespace {
// Stores a cached version of each database, keyed by a unique integer obtained // Stores a cached version of each database, keyed by a unique integer obtained
// by providing an origin-name pair. // by providing an origin-name pair.
class DatabaseVersionCache { class DatabaseVersionCache {
USING_FAST_MALLOC(DatabaseVersionCache);
public: public:
Mutex& GetMutex() const LOCK_RETURNED(mutex_) { return mutex_; } Mutex& GetMutex() const LOCK_RETURNED(mutex_) { return mutex_; }
......
...@@ -42,10 +42,9 @@ namespace blink { ...@@ -42,10 +42,9 @@ namespace blink {
// A class that abstracts the file system related operations required // A class that abstracts the file system related operations required
// by the WebKit database code. // by the WebKit database code.
class SQLiteFileSystem { class SQLiteFileSystem {
public: STATIC_ONLY(SQLiteFileSystem);
// This class is used as a namespace, so instantiating it doesn't make sense.
SQLiteFileSystem() = delete;
public:
// Initializes SQLite for Blink's use. // Initializes SQLite for Blink's use.
// //
// This must be called exactly once in each renderer process that uses SQLite. // This must be called exactly once in each renderer process that uses SQLite.
......
...@@ -111,6 +111,8 @@ class DOMWebSocketWithMockChannel final : public DOMWebSocket { ...@@ -111,6 +111,8 @@ class DOMWebSocketWithMockChannel final : public DOMWebSocket {
}; };
class DOMWebSocketTestScope { class DOMWebSocketTestScope {
STACK_ALLOCATED();
public: public:
explicit DOMWebSocketTestScope(ExecutionContext* execution_context) explicit DOMWebSocketTestScope(ExecutionContext* execution_context)
: websocket_(DOMWebSocketWithMockChannel::Create(execution_context)) {} : websocket_(DOMWebSocketWithMockChannel::Create(execution_context)) {}
......
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