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

Side by Side Diff: net/proxy/proxy_resolver_v8.cc

Issue 1011133006: Move V8 snapshot loading code from isolate_holder to gin/v8_startup_data.{h,cc}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review comments. Created 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/proxy/proxy_resolver_v8.h" 5 #include "net/proxy/proxy_resolver_v8.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdio> 8 #include <cstdio>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/debug/leak_annotations.h" 12 #include "base/debug/leak_annotations.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/strings/string_tokenizer.h" 15 #include "base/strings/string_tokenizer.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "gin/array_buffer.h" 19 #include "gin/array_buffer.h"
20 #include "gin/public/isolate_holder.h" 20 #include "gin/public/isolate_holder.h"
21 #include "gin/v8_initializer.h"
21 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
22 #include "net/base/net_log.h" 23 #include "net/base/net_log.h"
23 #include "net/base/net_util.h" 24 #include "net/base/net_util.h"
24 #include "net/proxy/proxy_info.h" 25 #include "net/proxy/proxy_info.h"
25 #include "net/proxy/proxy_resolver_script.h" 26 #include "net/proxy/proxy_resolver_script.h"
26 #include "url/gurl.h" 27 #include "url/gurl.h"
27 #include "url/url_canon.h" 28 #include "url/url_canon.h"
28 #include "v8/include/v8.h" 29 #include "v8/include/v8.h"
29 30
30 // Notes on the javascript environment: 31 // Notes on the javascript environment:
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 SharedIsolateFactory() : has_initialized_v8_(false) {} 359 SharedIsolateFactory() : has_initialized_v8_(false) {}
359 360
360 // Lazily creates a v8::Isolate, or returns the already created instance. 361 // Lazily creates a v8::Isolate, or returns the already created instance.
361 v8::Isolate* GetSharedIsolate() { 362 v8::Isolate* GetSharedIsolate() {
362 base::AutoLock l(lock_); 363 base::AutoLock l(lock_);
363 364
364 if (!holder_) { 365 if (!holder_) {
365 // Do one-time initialization for V8. 366 // Do one-time initialization for V8.
366 if (!has_initialized_v8_) { 367 if (!has_initialized_v8_) {
367 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 368 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
368 gin::IsolateHolder::LoadV8Snapshot(); 369 gin::V8Initializer::LoadV8Snapshot();
369 #endif 370 #endif
370 371
371 gin::IsolateHolder::Initialize( 372 gin::IsolateHolder::Initialize(
372 gin::IsolateHolder::kNonStrictMode, 373 gin::IsolateHolder::kNonStrictMode,
373 gin::ArrayBufferAllocator::SharedInstance()); 374 gin::ArrayBufferAllocator::SharedInstance());
374 375
375 has_initialized_v8_ = true; 376 has_initialized_v8_ = true;
376 } 377 }
377 378
378 holder_.reset(new gin::IsolateHolder); 379 holder_.reset(new gin::IsolateHolder);
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 return 0; 888 return 0;
888 889
889 v8::Locker locked(isolate); 890 v8::Locker locked(isolate);
890 v8::Isolate::Scope isolate_scope(isolate); 891 v8::Isolate::Scope isolate_scope(isolate);
891 v8::HeapStatistics heap_statistics; 892 v8::HeapStatistics heap_statistics;
892 isolate->GetHeapStatistics(&heap_statistics); 893 isolate->GetHeapStatistics(&heap_statistics);
893 return heap_statistics.used_heap_size(); 894 return heap_statistics.used_heap_size();
894 } 895 }
895 896
896 } // namespace net 897 } // namespace net
OLDNEW
« gin/v8_initializer.h ('K') | « gin/v8_initializer.cc ('k') | ppapi/proxy/pdf_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698