Remove unused features of Tonic

Turns out we don't have any clients for these anymore.

Change-Id: Ief14a32cad3fb02f43844d63c129adb77615e061
diff --git a/BUILD.gn b/BUILD.gn
index 3d3c483..a9578cb 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -10,8 +10,6 @@
     "dart_class_library.h",
     "dart_class_provider.cc",
     "dart_class_provider.h",
-    "dart_direct_wrappable.cc",
-    "dart_direct_wrappable.h",
     "dart_library_natives.cc",
     "dart_library_natives.h",
     "dart_library_provider.cc",
diff --git a/dart_direct_wrappable.cc b/dart_direct_wrappable.cc
deleted file mode 100644
index de03228..0000000
--- a/dart_direct_wrappable.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2015 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "lib/tonic/dart_direct_wrappable.h"
-
-#include "lib/tonic/dart_class_library.h"
-#include "lib/tonic/logging/dart_error.h"
-#include "lib/tonic/dart_state.h"
-#include "lib/tonic/dart_wrappable.h"
-#include "lib/tonic/dart_wrapper_info.h"
-
-namespace tonic {
-
-Dart_Handle DartDirectWrappable<void*>::Wrap(DartState* dart_state,
-                                             void* val,
-                                             const DartWrapperInfo& info) {
-  Dart_PersistentHandle type = dart_state->class_library().GetClass(info);
-  FTL_DCHECK(!LogIfError(type));
-
-  intptr_t native_fields[DartWrappable::kNumberOfNativeFields];
-  native_fields[DartWrappable::kPeerIndex] = reinterpret_cast<intptr_t>(val);
-  native_fields[DartWrappable::kWrapperInfoIndex] =
-      reinterpret_cast<intptr_t>(&info);
-  Dart_Handle wrapper = Dart_AllocateWithNativeFields(
-      type, DartWrappable::kNumberOfNativeFields, native_fields);
-  FTL_DCHECK(!LogIfError(wrapper));
-  return wrapper;
-}
-
-void* DartDirectWrappable<void*>::FromDart(Dart_Handle handle) {
-  intptr_t peer = 0;
-  Dart_Handle result =
-      Dart_GetNativeInstanceField(handle, DartWrappable::kPeerIndex, &peer);
-  if (Dart_IsError(result))
-    return nullptr;
-  return reinterpret_cast<void*>(peer);
-}
-
-void* DartDirectWrappable<void*>::FromArguments(Dart_NativeArguments args,
-                                                int index,
-                                                Dart_Handle& exception) {
-  intptr_t native_fields[DartWrappable::kNumberOfNativeFields];
-  Dart_Handle result = Dart_GetNativeFieldsOfArgument(
-      args, index, DartWrappable::kNumberOfNativeFields, native_fields);
-  if (Dart_IsError(result)) {
-    exception = Dart_NewStringFromCString(DartError::kInvalidArgument);
-    return nullptr;
-  }
-  return reinterpret_cast<void*>(native_fields[DartWrappable::kPeerIndex]);
-}
-
-}  // namespace tonic
diff --git a/dart_direct_wrappable.h b/dart_direct_wrappable.h
deleted file mode 100644
index a907cc2..0000000
--- a/dart_direct_wrappable.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2016 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef LIB_TONIC_DART_DIRECT_WRAPPABLE_H_
-#define LIB_TONIC_DART_DIRECT_WRAPPABLE_H_
-
-#include "dart/runtime/include/dart_api.h"
-#include "lib/tonic/converter/dart_converter.h"
-#include "lib/tonic/dart_state.h"
-
-namespace tonic {
-struct DartWrapperInfo;
-
-template <typename T>
-struct DartDirectWrappable;
-
-template <>
-struct DartDirectWrappable<void*> {
-  static Dart_Handle Wrap(DartState* dart_state,
-                          void* val,
-                          const DartWrapperInfo& info);
-  static void* FromDart(Dart_Handle handle);
-  static void* FromArguments(Dart_NativeArguments args,
-                             int index,
-                             Dart_Handle& exception);
-};
-
-template <typename T>
-struct DartDirectWrappable {
-  static Dart_Handle Wrap(DartState* dart_state,
-                          T val,
-                          const DartWrapperInfo& info) {
-    return DartDirectWrappable<void*>::Wrap(dart_state, static_cast<void*>(val),
-                                            info);
-  }
-
-  static T FromDart(Dart_Handle handle) {
-    return static_cast<T>(DartDirectWrappable<void*>::FromDart(handle));
-  }
-
-  static T FromArguments(Dart_NativeArguments args,
-                         int index,
-                         Dart_Handle& exception) {
-    return static_cast<T>(
-        DartDirectWrappable<void*>::FromArguments(args, index, exception));
-  }
-};
-
-template <typename T, const DartWrapperInfo& (*GetWrapperInfo)()>
-struct DartConverterDirectWrappable {
-  static Dart_Handle ToDart(T val) {
-    if (!val)
-      return Dart_Null();
-    return DartDirectWrappable<T>::Wrap(DartState::Current(), val,
-                                        GetWrapperInfo());
-  }
-
-  static void SetReturnValue(Dart_NativeArguments args, T val) {
-    Dart_SetReturnValue(args, ToDart(val));
-  }
-
-  static T FromDart(Dart_Handle handle) {
-    return DartDirectWrappable<T>::FromDart(handle);
-  }
-
-  static T FromArguments(Dart_NativeArguments args,
-                         int index,
-                         Dart_Handle& exception) {
-    return DartDirectWrappable<T>::FromArguments(args, index, exception);
-  }
-};
-
-#define IMPLEMENT_DIRECT_WRAPPABLE(LibraryName, DartName, ImplType)          \
-  static const DartWrapperInfo kDartWrapperInfo_##LibraryName_##DartName = { \
-      #LibraryName, #DartName, 0, 0, 0,                                      \
-  };                                                                         \
-  static const DartWrapperInfo&                                              \
-      GetWrapperTypeInfo_##LibraryName_##DartName() {                        \
-    return kDartWrapperInfo_##LibraryName_##DartName;                        \
-  }                                                                          \
-  template <>                                                                \
-  struct DartConverter<ImplType>                                             \
-      : public DartConverterDirectWrappable<                                 \
-            ImplType, GetWrapperTypeInfo_##LibraryName_##DartName> {};
-
-}  // namespace tonic
-
-#endif  // LIB_TONIC_DART_DIRECT_WRAPPABLE_H_
diff --git a/dart_message_handler.cc b/dart_message_handler.cc
index 2661a4e..60d7e35 100644
--- a/dart_message_handler.cc
+++ b/dart_message_handler.cc
@@ -15,7 +15,6 @@
 
 DartMessageHandler::DartMessageHandler()
     : handled_first_message_(false),
-      quit_message_loop_when_isolate_exits_(true),
       isolate_exited_(false),
       isolate_had_uncaught_exception_error_(false),
       task_runner_(nullptr) {}
@@ -99,11 +98,6 @@
       Dart_SetPausedOnExit(true);
     } else {
       isolate_exited_ = true;
-      if (quit_message_loop_when_isolate_exits()) {
-        // Quit.
-        // XYZZY
-        // base::MessageLoop::current()->QuitWhenIdle();
-      }
     }
   }
 }
diff --git a/dart_message_handler.h b/dart_message_handler.h
index 8c479d7..4225cea 100644
--- a/dart_message_handler.h
+++ b/dart_message_handler.h
@@ -21,17 +21,6 @@
   // Messages for the current isolate will be scheduled on |runner|.
   void Initialize(const ftl::RefPtr<ftl::TaskRunner>& runner);
 
-  // Request the message loop to quit when isolate exits? Default is true.
-  void set_quit_message_loop_when_isolate_exits(
-      bool quit_message_loop_when_isolate_exits) {
-    quit_message_loop_when_isolate_exits_ =
-        quit_message_loop_when_isolate_exits;
-  }
-
-  bool quit_message_loop_when_isolate_exits() const {
-    return quit_message_loop_when_isolate_exits_;
-  }
-
   // Did the isolate exit?
   bool isolate_exited() const { return isolate_exited_; }
 
@@ -57,7 +46,6 @@
   }
 
   bool handled_first_message_;
-  bool quit_message_loop_when_isolate_exits_;
   bool isolate_exited_;
   bool isolate_had_uncaught_exception_error_;
   ftl::RefPtr<ftl::TaskRunner> task_runner_;