Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp

Issue 1776943002: Register ArrayBufferContents' adjustAmountOfMemory in V8Initializer::initialize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/testing/RunAllTests.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 344 }
345 345
346 void Free(void* data, size_t size) override 346 void Free(void* data, size_t size) override
347 { 347 {
348 WTF::ArrayBufferContents::freeMemory(data, size); 348 WTF::ArrayBufferContents::freeMemory(data, size);
349 } 349 }
350 }; 350 };
351 351
352 } // namespace 352 } // namespace
353 353
354 static void adjustAmountOfExternalAllocatedMemory(int size)
355 {
356 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size);
357 }
358
354 void V8Initializer::initializeMainThread() 359 void V8Initializer::initializeMainThread()
355 { 360 {
356 ASSERT(isMainThread()); 361 ASSERT(isMainThread());
357 362
363 WTF::ArrayBufferContents::initialize(adjustAmountOfExternalAllocatedMemory);
364
358 DEFINE_STATIC_LOCAL(ArrayBufferAllocator, arrayBufferAllocator, ()); 365 DEFINE_STATIC_LOCAL(ArrayBufferAllocator, arrayBufferAllocator, ());
359 auto v8ExtrasMode = RuntimeEnabledFeatures::experimentalV8ExtrasEnabled() ? gin::IsolateHolder::kStableAndExperimentalV8Extras : gin::IsolateHolder::kStable V8Extras; 366 auto v8ExtrasMode = RuntimeEnabledFeatures::experimentalV8ExtrasEnabled() ? gin::IsolateHolder::kStableAndExperimentalV8Extras : gin::IsolateHolder::kStable V8Extras;
360 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, v8ExtrasM ode, &arrayBufferAllocator); 367 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, v8ExtrasM ode, &arrayBufferAllocator);
361 368
362 v8::Isolate* isolate = V8PerIsolateData::initialize(); 369 v8::Isolate* isolate = V8PerIsolateData::initialize();
363 370
364 initializeV8Common(isolate); 371 initializeV8Common(isolate);
365 372
366 isolate->SetFatalErrorHandler(reportFatalErrorInMainThread); 373 isolate->SetFatalErrorHandler(reportFatalErrorInMainThread);
367 isolate->AddMessageListener(messageHandlerInMainThread); 374 isolate->AddMessageListener(messageHandlerInMainThread);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 454
448 isolate->AddMessageListener(messageHandlerInWorker); 455 isolate->AddMessageListener(messageHandlerInWorker);
449 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); 456 isolate->SetFatalErrorHandler(reportFatalErrorInWorker);
450 457
451 uint32_t here; 458 uint32_t here;
452 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); 459 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*)));
453 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); 460 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
454 } 461 }
455 462
456 } // namespace blink 463 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/testing/RunAllTests.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698