Clean up Add/Remove space.

Deleted the set_as_default parameter and added a new function
SetSpaceAsDefault instead.

Change-Id: Ic4c359854d08e64ac0d0df92f0105447adb9df36
diff --git a/runtime/gc/space/space_test.h b/runtime/gc/space/space_test.h
index 28200df..3335e72 100644
--- a/runtime/gc/space/space_test.h
+++ b/runtime/gc/space/space_test.h
@@ -38,9 +38,13 @@
   SpaceTest() : byte_array_class_(nullptr) {
   }
 
-  void AddSpace(ContinuousSpace* space) {
-    // By passing true, AddSpace() does the revoke.
-    Runtime::Current()->GetHeap()->AddSpace(space, true);
+  void AddSpace(ContinuousSpace* space, bool revoke = true) {
+    Heap* heap = Runtime::Current()->GetHeap();
+    if (revoke) {
+      heap->RevokeAllThreadLocalBuffers();
+    }
+    heap->AddSpace(space);
+    heap->SetSpaceAsDefault(space);
   }
 
   mirror::Class* GetByteArrayClass(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -227,15 +231,16 @@
   gc::Heap* heap = Runtime::Current()->GetHeap();
   space::Space* old_space = space;
   heap->RemoveSpace(old_space);
+  heap->RevokeAllThreadLocalBuffers();
   space::ZygoteSpace* zygote_space = space->CreateZygoteSpace("alloc space",
                                                               heap->IsLowMemoryMode(),
                                                               &space);
   delete old_space;
   // Add the zygote space.
-  AddSpace(zygote_space);
+  AddSpace(zygote_space, false);
 
   // Make space findable to the heap, will also delete space when runtime is cleaned up
-  AddSpace(space);
+  AddSpace(space, false);
 
   // Succeeds, fits without adjusting the footprint limit.
   ptr1.reset(Alloc(space, self, 1 * MB, &ptr1_bytes_allocated, &ptr1_usable_size));