[dart] Use an appropriate namespace for runner utilities.

Bug: DX-1073
Change-Id: I1c1df536e2e22c1a7f92a35f7236fd73385c3d87
diff --git a/runtime/dart/utils/handle_exception.cc b/runtime/dart/utils/handle_exception.cc
index 661f976..3063b92 100644
--- a/runtime/dart/utils/handle_exception.cc
+++ b/runtime/dart/utils/handle_exception.cc
@@ -39,8 +39,7 @@
 }
 }  // namespace
 
-namespace fuchsia {
-namespace dart {
+namespace dart_utils {
 
 zx_status_t HandleIfException(std::shared_ptr<::sys::ServiceDirectory> services,
                               const std::string& component_url,
@@ -91,5 +90,4 @@
   return ZX_OK;
 }
 
-}  // namespace dart
-}  // namespace fuchsia
+}  // namespace dart_utils
diff --git a/runtime/dart/utils/handle_exception.h b/runtime/dart/utils/handle_exception.h
index 2c41d53..a58e890 100644
--- a/runtime/dart/utils/handle_exception.h
+++ b/runtime/dart/utils/handle_exception.h
@@ -12,8 +12,7 @@
 #include <sys/types.h>
 #include <third_party/dart/runtime/include/dart_api.h>
 
-namespace fuchsia {
-namespace dart {
+namespace dart_utils {
 
 // If |result| is a Dart Exception, passes the exception message and stack trace
 // to the crash analyzer service for further handling.
@@ -30,7 +29,6 @@
                             const std::string& error,
                             const std::string& stack_trace);
 
-}  // namespace dart
-}  // namespace fuchsia
+}  // namespace dart_utils
 
 #endif  // TOPAZ_RUNTIME_DART_UTILS_HANDLE_EXCEPTION_H_
diff --git a/runtime/dart/utils/logging.h b/runtime/dart/utils/logging.h
index 740296f..3210de7 100644
--- a/runtime/dart/utils/logging.h
+++ b/runtime/dart/utils/logging.h
@@ -5,13 +5,11 @@
 #ifndef TOPAZ_RUNTIME_DART_UTILS_LOGGING_H_
 #define TOPAZ_RUNTIME_DART_UTILS_LOGGING_H_
 
-namespace fuchsia {
-namespace dart {
+namespace dart_utils {
 
 // Use to mark logs published via the syslog API.
 #define LOG_TAG "dart-utils"
 
-}  // namespace dart
-}  // namespace fuchsia
+}  // namespace dart_utils
 
 #endif  // TOPAZ_RUNTIME_DART_UTILS_LOGGING_H_
diff --git a/runtime/dart/utils/tempfs.cc b/runtime/dart/utils/tempfs.cc
index 0070ad1..6fd93dd 100644
--- a/runtime/dart/utils/tempfs.cc
+++ b/runtime/dart/utils/tempfs.cc
@@ -42,8 +42,7 @@
 
 }  // namespace
 
-namespace fuchsia {
-namespace dart {
+namespace dart_utils {
 
 // Set up a memfs bound to /tmp in the process-wide namespace that has the
 // lifetime of the process.
@@ -87,5 +86,4 @@
   }
 }
 
-}  // namespace dart
-}  // namespace fuchsia
+}  // namespace dart_utils
diff --git a/runtime/dart/utils/tempfs.h b/runtime/dart/utils/tempfs.h
index 1e1f154..c6a3819 100644
--- a/runtime/dart/utils/tempfs.h
+++ b/runtime/dart/utils/tempfs.h
@@ -9,8 +9,7 @@
 
 // Utility functions that set up /tmp for the dart_runner and flutter_runner.
 
-namespace fuchsia {
-namespace dart {
+namespace dart_utils {
 
 // Set up a memfs bound to /tmp in the process-wide namespace that has the
 // lifetime of the process.
@@ -20,7 +19,6 @@
 // /tmp in the given namespace.
 void SetupComponentTemp(fdio_ns_t* ns);
 
-}  // namespace dart
-}  // namespace fuchsia
+}  // namespace dart_utils
 
 #endif  // TOPAZ_RUNTIME_DART_UTILS_TEMPFS_H_
diff --git a/runtime/dart/utils/vmo.cc b/runtime/dart/utils/vmo.cc
index 7b9350d..c209ac9 100644
--- a/runtime/dart/utils/vmo.cc
+++ b/runtime/dart/utils/vmo.cc
@@ -38,8 +38,7 @@
 
 }  // namespace
 
-namespace fuchsia {
-namespace dart {
+namespace dart_utils {
 
 bool VmoFromFilename(const std::string& filename,
                      fuchsia::mem::Buffer* buffer) {
@@ -68,5 +67,4 @@
   return status;
 }
 
-}  // namespace dart
-}  // namespace fuchsia
+}  // namespace dart_utils
diff --git a/runtime/dart/utils/vmo.h b/runtime/dart/utils/vmo.h
index 8d4fa48..f81a54d 100644
--- a/runtime/dart/utils/vmo.h
+++ b/runtime/dart/utils/vmo.h
@@ -9,8 +9,7 @@
 
 #include <fuchsia/mem/cpp/fidl.h>
 
-namespace fuchsia {
-namespace dart {
+namespace dart_utils {
 
 bool VmoFromFilename(const std::string& filename, fuchsia::mem::Buffer* buffer);
 
@@ -19,7 +18,6 @@
 
 zx_status_t IsSizeValid(const fuchsia::mem::Buffer& buffer, bool* is_valid);
 
-}  // namespace dart
-}  // namespace fuchsia
+}  // namespace dart_utils
 
 #endif  // TOPAZ_RUNTIME_DART_UTILS_VMO_H_
diff --git a/runtime/dart/utils/vmservice_object.cc b/runtime/dart/utils/vmservice_object.cc
index 4062477..7596e80 100644
--- a/runtime/dart/utils/vmservice_object.cc
+++ b/runtime/dart/utils/vmservice_object.cc
@@ -33,8 +33,7 @@
 
 }
 
-namespace fuchsia {
-namespace dart {
+namespace dart_utils {
 
 void VMServiceObject::GetContents(LazyEntryVector* out_vector) const {
   // List /tmp/dart.services if it exists, and push its contents as
@@ -60,5 +59,4 @@
   return ZX_ERR_NOT_FOUND;
 }
 
-}  // namespace dart
-}  // namespace fuchsia
+}  // namespace dart_utils
diff --git a/runtime/dart/utils/vmservice_object.h b/runtime/dart/utils/vmservice_object.h
index 97a6618..d37c2a7 100644
--- a/runtime/dart/utils/vmservice_object.h
+++ b/runtime/dart/utils/vmservice_object.h
@@ -7,8 +7,7 @@
 
 #include <lib/vfs/cpp/lazy_dir.h>
 
-namespace fuchsia {
-namespace dart {
+namespace dart_utils {
 
 class VMServiceObject : public vfs::LazyDir {
  public:
@@ -21,7 +20,6 @@
                       uint64_t id, std::string name) const override;
 };
 
-}  // namespace dart
-}  // namespace fuchsia
+}  // namespace dart_utils
 
 #endif  // TOPAZ_RUNTIME_DART_UTILS_VMSERVICE_OBJECT_H_
diff --git a/runtime/dart_runner/dart_component_controller.cc b/runtime/dart_runner/dart_component_controller.cc
index 23202b7..a269d40 100644
--- a/runtime/dart_runner/dart_component_controller.cc
+++ b/runtime/dart_runner/dart_component_controller.cc
@@ -153,7 +153,7 @@
     return false;
   }
 
-  fuchsia::dart::SetupComponentTemp(namespace_);
+  dart_utils::SetupComponentTemp(namespace_);
 
   for (size_t i = 0; i < flat->paths.size(); ++i) {
     if (flat->paths.at(i) == kTmpPath) {
@@ -412,8 +412,8 @@
       FXL_LOG(ERROR) << Dart_GetError(main_result);
       return_code_ = tonic::GetErrorExitCode(main_result);
 
-      fuchsia::dart::HandleIfException(runner_incoming_services_, url_,
-                                       main_result);
+      dart_utils::HandleIfException(runner_incoming_services_, url_,
+                                    main_result);
     }
     Dart_ExitScope();
     return false;
@@ -461,7 +461,7 @@
     return;
   }
 
-  fuchsia::dart::HandleIfException(runner_incoming_services_, url_, result);
+  dart_utils::HandleIfException(runner_incoming_services_, url_, result);
 
   // Otherwise, see if there was any other error.
   return_code_ = tonic::GetErrorExitCode(result);
diff --git a/runtime/dart_runner/dart_runner.cc b/runtime/dart_runner/dart_runner.cc
index abe14a0..ece12e6 100644
--- a/runtime/dart_runner/dart_runner.cc
+++ b/runtime/dart_runner/dart_runner.cc
@@ -132,8 +132,8 @@
   // vm service protocol port under /tmp. The VMServiceObject exposes that
   // port number to The Hub.
   context_->outgoing()->debug_dir()->AddEntry(
-      fuchsia::dart::VMServiceObject::kPortDirName,
-      std::make_unique<fuchsia::dart::VMServiceObject>());
+      dart_utils::VMServiceObject::kPortDirName,
+      std::make_unique<dart_utils::VMServiceObject>());
 
 #endif  // !defined(DART_PRODUCT)
 
diff --git a/runtime/dart_runner/main.cc b/runtime/dart_runner/main.cc
index 23c5073..afa4a99 100644
--- a/runtime/dart_runner/main.cc
+++ b/runtime/dart_runner/main.cc
@@ -19,7 +19,7 @@
     trace::TraceProvider::CreateSynchronously(loop.dispatcher(), "dart_runner",
                                               &provider, &already_started);
   }
-  fuchsia::dart::SetupRunnerTemp();
+  dart_utils::SetupRunnerTemp();
   dart_runner::DartRunner runner;
   loop.Run();
   return 0;
diff --git a/runtime/dart_runner/mapped_resource.cc b/runtime/dart_runner/mapped_resource.cc
index b927820..0ca3794 100644
--- a/runtime/dart_runner/mapped_resource.cc
+++ b/runtime/dart_runner/mapped_resource.cc
@@ -26,7 +26,7 @@
 
   fuchsia::mem::Buffer resource_vmo;
   if (namespc == nullptr) {
-    if (!fuchsia::dart::VmoFromFilename(path, &resource_vmo)) {
+    if (!dart_utils::VmoFromFilename(path, &resource_vmo)) {
       return false;
     }
   } else {
@@ -35,7 +35,7 @@
       return false;
     }
 
-    if (!fuchsia::dart::VmoFromFilenameAt(root_dir, path, &resource_vmo)) {
+    if (!dart_utils::VmoFromFilenameAt(root_dir, path, &resource_vmo)) {
       return false;
     }
   }
diff --git a/runtime/flutter_runner/component.cc b/runtime/flutter_runner/component.cc
index c93d27a..81650ff 100644
--- a/runtime/flutter_runner/component.cc
+++ b/runtime/flutter_runner/component.cc
@@ -108,7 +108,7 @@
   }
 
   // Setup /tmp to be mapped to the process-local memfs.
-  fuchsia::dart::SetupComponentTemp(fdio_ns_.get());
+  dart_utils::SetupComponentTemp(fdio_ns_.get());
 
   // LaunchInfo::flat_namespace optional.
   for (size_t i = 0; i < startup_info.flat_namespace.paths.size(); ++i) {
@@ -307,8 +307,8 @@
           const std::string& error, const std::string& stack_trace) {
         async::PostTask(dispatcher,
             [runner_incoming_services, component_url, error, stack_trace]() {
-              fuchsia::dart::HandleException(runner_incoming_services,
-                                             component_url, error, stack_trace);
+              dart_utils::HandleException(runner_incoming_services,
+                                          component_url, error, stack_trace);
             });
         // Ideally we would return whether HandleException returned ZX_OK, but
         // short of knowing if the exception was correctly handled, we return
@@ -328,7 +328,7 @@
   FileInNamespaceBuffer(int namespace_fd, const char* path, bool executable)
       : address_(nullptr), size_(0) {
     fuchsia::mem::Buffer buffer;
-    if (!fuchsia::dart::VmoFromFilenameAt(namespace_fd, path, &buffer)) {
+    if (!dart_utils::VmoFromFilenameAt(namespace_fd, path, &buffer)) {
       return;
     }
     if (buffer.size == 0) {
diff --git a/runtime/flutter_runner/fuchsia_font_manager.cc b/runtime/flutter_runner/fuchsia_font_manager.cc
index ef4a3e0..26ff6e5 100644
--- a/runtime/flutter_runner/fuchsia_font_manager.cc
+++ b/runtime/flutter_runner/fuchsia_font_manager.cc
@@ -63,7 +63,7 @@
                                    int buffer_id,
                                    fit::function<void()> release_proc) {
   bool is_valid;
-  zx_status_t status = fuchsia::dart::IsSizeValid(data, &is_valid);
+  zx_status_t status = dart_utils::IsSizeValid(data, &is_valid);
   if (!is_valid || data.size > std::numeric_limits<size_t>::max()) {
     return nullptr;
   }
diff --git a/runtime/flutter_runner/main.cc b/runtime/flutter_runner/main.cc
index 01db5a4..cf0a6c2 100644
--- a/runtime/flutter_runner/main.cc
+++ b/runtime/flutter_runner/main.cc
@@ -25,7 +25,7 @@
   }
 
   // Set up the process-wide /tmp memfs.
-  fuchsia::dart::SetupRunnerTemp();
+  dart_utils::SetupRunnerTemp();
 
   FML_DLOG(INFO) << "Flutter application services initialized.";
 
diff --git a/runtime/flutter_runner/runner.cc b/runtime/flutter_runner/runner.cc
index 0530507..ad6cb55 100644
--- a/runtime/flutter_runner/runner.cc
+++ b/runtime/flutter_runner/runner.cc
@@ -50,7 +50,7 @@
   const char* data_path = kIcuDataPath;
 
   fuchsia::mem::Buffer icu_data;
-  if (!fuchsia::dart::VmoFromFilename(data_path, &icu_data)) {
+  if (!dart_utils::VmoFromFilename(data_path, &icu_data)) {
     return false;
   }
 
@@ -95,8 +95,8 @@
   // vm service protocol port under /tmp. The VMServiceObject exposes that
   // port number to The Hub.
   host_context_->outgoing()->debug_dir()->AddEntry(
-      fuchsia::dart::VMServiceObject::kPortDirName,
-      std::make_unique<fuchsia::dart::VMServiceObject>());
+      dart_utils::VMServiceObject::kPortDirName,
+      std::make_unique<dart_utils::VMServiceObject>());
 
   SetupTraceObserver();
 #endif  // !defined(DART_PRODUCT)
diff --git a/runtime/flutter_runner/runner.h b/runtime/flutter_runner/runner.h
index 9008bdb..bc94686 100644
--- a/runtime/flutter_runner/runner.h
+++ b/runtime/flutter_runner/runner.h
@@ -51,7 +51,7 @@
 
 #if !defined(DART_PRODUCT)
   // The connection between the Dart VM service and The Hub.
-  std::unique_ptr<fuchsia::dart::VMServiceObject> vmservice_object_;
+  std::unique_ptr<dart_utils::VMServiceObject> vmservice_object_;
 
   std::unique_ptr<trace::TraceObserver> trace_observer_;
   trace_prolonged_context_t* prolonged_context_;