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

Side by Side Diff: gin/isolate_holder.cc

Issue 1835553002: Control ES2015 'Tail call elimination' language feature via finch flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed redness by moving FeatureList initialization in tests up the call stack. Created 4 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gin/public/isolate_holder.h" 5 #include "gin/public/isolate_holder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/feature_list.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/sys_info.h" 15 #include "base/sys_info.h"
15 #include "gin/debug_impl.h" 16 #include "gin/debug_impl.h"
16 #include "gin/function_template.h" 17 #include "gin/function_template.h"
17 #include "gin/per_isolate_data.h" 18 #include "gin/per_isolate_data.h"
18 #include "gin/run_microtasks_observer.h" 19 #include "gin/run_microtasks_observer.h"
19 #include "gin/v8_initializer.h" 20 #include "gin/v8_initializer.h"
20 #include "gin/v8_isolate_memory_dump_provider.h" 21 #include "gin/v8_isolate_memory_dump_provider.h"
21 22
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 isolate_ = NULL; 75 isolate_ = NULL;
75 } 76 }
76 77
77 // static 78 // static
78 void IsolateHolder::Initialize(ScriptMode mode, 79 void IsolateHolder::Initialize(ScriptMode mode,
79 V8ExtrasMode v8_extras_mode, 80 V8ExtrasMode v8_extras_mode,
80 v8::ArrayBuffer::Allocator* allocator) { 81 v8::ArrayBuffer::Allocator* allocator) {
81 CHECK(allocator); 82 CHECK(allocator);
82 V8Initializer::Initialize(mode, v8_extras_mode); 83 V8Initializer::Initialize(mode, v8_extras_mode);
83 g_array_buffer_allocator = allocator; 84 g_array_buffer_allocator = allocator;
85
86 // Initialize an instance of FeatureList. This will be a no-op if an instance
87 // was already set up by the embedder.
88 base::FeatureList::InitializeInstance();
89
90 const base::Feature kES2015TailCallsFeature {
91 "V8_ES2015_TailCalls", base::FEATURE_DISABLED_BY_DEFAULT
92 };
93 if (base::FeatureList::IsEnabled(kES2015TailCallsFeature)) {
94 static const char harmony_tailcalls[] = "--harmony-tailcalls";
95 v8::V8::SetFlagsFromString(harmony_tailcalls,
96 sizeof(harmony_tailcalls) - 1);
97 }
84 } 98 }
85 99
86 void IsolateHolder::AddRunMicrotasksObserver() { 100 void IsolateHolder::AddRunMicrotasksObserver() {
87 DCHECK(!task_observer_.get()); 101 DCHECK(!task_observer_.get());
88 task_observer_.reset(new RunMicrotasksObserver(isolate_)); 102 task_observer_.reset(new RunMicrotasksObserver(isolate_));
89 base::MessageLoop::current()->AddTaskObserver(task_observer_.get()); 103 base::MessageLoop::current()->AddTaskObserver(task_observer_.get());
90 } 104 }
91 105
92 void IsolateHolder::RemoveRunMicrotasksObserver() { 106 void IsolateHolder::RemoveRunMicrotasksObserver() {
93 DCHECK(task_observer_.get()); 107 DCHECK(task_observer_.get());
94 base::MessageLoop::current()->RemoveTaskObserver(task_observer_.get()); 108 base::MessageLoop::current()->RemoveTaskObserver(task_observer_.get());
95 task_observer_.reset(); 109 task_observer_.reset();
96 } 110 }
97 111
98 void IsolateHolder::EnableIdleTasks( 112 void IsolateHolder::EnableIdleTasks(
99 scoped_ptr<V8IdleTaskRunner> idle_task_runner) { 113 scoped_ptr<V8IdleTaskRunner> idle_task_runner) {
100 DCHECK(isolate_data_.get()); 114 DCHECK(isolate_data_.get());
101 isolate_data_->EnableIdleTasks(std::move(idle_task_runner)); 115 isolate_data_->EnableIdleTasks(std::move(idle_task_runner));
102 } 116 }
103 117
104 } // namespace gin 118 } // namespace gin
OLDNEW
« base/test/test_suite.cc ('K') | « content/test/test_blink_web_unit_test_support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698