Chromium Code Reviews| Index: src/serialize.h |
| diff --git a/src/serialize.h b/src/serialize.h |
| index 1fc125bcd38188e1540dc532a223a2bea6c061d7..4f3fc1f8f64ca4c764115f8f52b9c14bb38e1db9 100644 |
| --- a/src/serialize.h |
| +++ b/src/serialize.h |
| @@ -470,13 +470,16 @@ class Serializer : public SerializerDeserializer { |
| } |
| Isolate* isolate() const { return isolate_; } |
| - static void Enable(Isolate* isolate); |
| - static void Disable(); |
| - |
| - // Call this when you have made use of the fact that there is no serialization |
| - // going on. |
| - static void TooLateToEnableNow() { too_late_to_enable_now_ = true; } |
| - static bool enabled() { return serialization_enabled_; } |
| + static void RequestEnable(Isolate* isolate); |
| + static void InitializeOncePerProcess(); |
| + static void TearDown(); |
| + |
| + static bool enabled() { |
| + SerializationState state = static_cast<SerializationState>( |
| + NoBarrier_Load(&serialization_state_)); |
| + ASSERT(state != SERIALIZER_STATE_UNINITIALIZED); |
| + return state == SERIALIZER_STATE_ENABLED; |
| + } |
| SerializationAddressMapper* address_mapper() { return &address_mapper_; } |
| void PutRoot(int index, |
| HeapObject* object, |
| @@ -574,9 +577,15 @@ class Serializer : public SerializerDeserializer { |
| int fullness_[LAST_SPACE + 1]; |
| SnapshotByteSink* sink_; |
| ExternalReferenceEncoder* external_reference_encoder_; |
| - static bool serialization_enabled_; |
| - // Did we already make use of the fact that serialization was not enabled? |
| - static bool too_late_to_enable_now_; |
| + |
| + enum SerializationState { |
| + SERIALIZER_STATE_UNINITIALIZED = 0, |
| + SERIALIZER_STATE_DISABLED = 1, |
| + SERIALIZER_STATE_ENABLED = 2 |
| + }; |
| + |
| + static Atomic32 serialization_state_; |
|
Hannes Payer (out of office)
2014/04/17 09:48:10
I would prefer AtomicWord
mvstanton
2014/04/17 14:18:29
Done.
|
| + |
| SerializationAddressMapper address_mapper_; |
| intptr_t root_index_wave_front_; |
| void Pad(); |