OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "serialize.h" | 45 #include "serialize.h" |
46 #include "store-buffer.h" | 46 #include "store-buffer.h" |
47 | 47 |
48 namespace v8 { | 48 namespace v8 { |
49 namespace internal { | 49 namespace internal { |
50 | 50 |
51 V8_DECLARE_ONCE(init_once); | 51 V8_DECLARE_ONCE(init_once); |
52 | 52 |
53 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; | 53 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; |
54 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; | 54 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; |
| 55 v8::Platform* V8::platform_ = NULL; |
55 | 56 |
56 | 57 |
57 bool V8::Initialize(Deserializer* des) { | 58 bool V8::Initialize(Deserializer* des) { |
58 InitializeOncePerProcess(); | 59 InitializeOncePerProcess(); |
59 | 60 |
60 // The current thread may not yet had entered an isolate to run. | 61 // The current thread may not yet had entered an isolate to run. |
61 // Note the Isolate::Current() may be non-null because for various | 62 // Note the Isolate::Current() may be non-null because for various |
62 // initialization purposes an initializing thread may be assigned an isolate | 63 // initialization purposes an initializing thread may be assigned an isolate |
63 // but not actually enter it. | 64 // but not actually enter it. |
64 if (i::Isolate::CurrentPerIsolateThreadData() == NULL) { | 65 if (i::Isolate::CurrentPerIsolateThreadData() == NULL) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 SetUpJSCallerSavedCodeData(); | 188 SetUpJSCallerSavedCodeData(); |
188 ExternalReference::SetUp(); | 189 ExternalReference::SetUp(); |
189 Bootstrapper::InitializeOncePerProcess(); | 190 Bootstrapper::InitializeOncePerProcess(); |
190 } | 191 } |
191 | 192 |
192 | 193 |
193 void V8::InitializeOncePerProcess() { | 194 void V8::InitializeOncePerProcess() { |
194 CallOnce(&init_once, &InitializeOncePerProcessImpl); | 195 CallOnce(&init_once, &InitializeOncePerProcessImpl); |
195 } | 196 } |
196 | 197 |
| 198 |
| 199 void V8::InitializePlatform(v8::Platform* platform) { |
| 200 ASSERT(!platform_); |
| 201 ASSERT(platform); |
| 202 platform_ = platform; |
| 203 } |
| 204 |
| 205 |
| 206 void V8::ShutdownPlatform() { |
| 207 ASSERT(platform_); |
| 208 platform_ = NULL; |
| 209 } |
| 210 |
| 211 |
| 212 v8::Platform* V8::GetCurrentPlatform() { |
| 213 ASSERT(platform_); |
| 214 return platform_; |
| 215 } |
| 216 |
197 } } // namespace v8::internal | 217 } } // namespace v8::internal |
OLD | NEW |