diff --git a/engine/tonic/dart_library_loader.cc b/engine/tonic/dart_library_loader.cc index 44f49de3dc3..6e9525eefa5 100644 --- a/engine/tonic/dart_library_loader.cc +++ b/engine/tonic/dart_library_loader.cc @@ -21,7 +21,7 @@ using mojo::common::DataPipeDrainer; namespace blink { // A DartLibraryLoader::Job represents a network load. It fetches data from the -// network and buffers the data in Vector. To cancel the job, delete this +// network and buffers the data in std::vector. To cancel the job, delete this // object. class DartLibraryLoader::Job : public DartDependency, public DataPipeDrainer::Client { @@ -37,7 +37,7 @@ class DartLibraryLoader::Job : public DartDependency, protected: DartLibraryLoader* loader_; // TODO(abarth): Should we be using SharedBuffer to buffer the data? - Vector buffer_; + std::vector buffer_; private: void OnStreamAvailable(mojo::ScopedDataPipeConsumerHandle pipe) { @@ -50,7 +50,8 @@ class DartLibraryLoader::Job : public DartDependency, // DataPipeDrainer::Client void OnDataAvailable(const void* data, size_t num_bytes) override { - buffer_.append(static_cast(data), num_bytes); + const uint8_t* bytes = static_cast(data); + buffer_.insert(buffer_.end(), bytes, bytes + num_bytes); } // Subclasses must implement OnDataComplete. @@ -141,20 +142,20 @@ class DartLibraryLoader::WatcherSignaler { resolved_dependency_(resolved_dependency) {} ~WatcherSignaler() { - Vector completed_watchers; + std::vector completed_watchers; for (const auto& watcher : loader_.dependency_watchers_) { if (watcher->DidResolveDependency(resolved_dependency_, catcher_->dependencies())) - completed_watchers.append(watcher.get()); + completed_watchers.push_back(watcher.get()); } // Notice that we remove the dependency catcher and extract all the // callbacks before running any of them. We don't want to be re-entered // below the callbacks and end up in an inconsistent state. catcher_.clear(); - Vector callbacks; + std::vector callbacks; for (const auto& watcher : completed_watchers) { - callbacks.append(watcher->callback()); + callbacks.push_back(watcher->callback()); loader_.dependency_watchers_.remove(watcher); } @@ -235,8 +236,9 @@ Dart_Handle DartLibraryLoader::CanonicalizeURL(Dart_Handle library, return library_provider_->CanonicalizeURL(library, url); } -void DartLibraryLoader::DidCompleteImportJob(ImportJob* job, - const Vector& buffer) { +void DartLibraryLoader::DidCompleteImportJob( + ImportJob* job, + const std::vector& buffer) { DartIsolateScope scope(dart_state_->isolate()); DartApiScope api_scope; @@ -254,8 +256,9 @@ void DartLibraryLoader::DidCompleteImportJob(ImportJob* job, jobs_.remove(job); } -void DartLibraryLoader::DidCompleteSourceJob(SourceJob* job, - const Vector& buffer) { +void DartLibraryLoader::DidCompleteSourceJob( + SourceJob* job, + const std::vector& buffer) { DartIsolateScope scope(dart_state_->isolate()); DartApiScope api_scope; diff --git a/engine/tonic/dart_library_loader.h b/engine/tonic/dart_library_loader.h index 566640fb1bb..da962d9cded 100644 --- a/engine/tonic/dart_library_loader.h +++ b/engine/tonic/dart_library_loader.h @@ -5,6 +5,7 @@ #ifndef SKY_ENGINE_TONIC_DART_LIBRARY_LOADER_H_ #define SKY_ENGINE_TONIC_DART_LIBRARY_LOADER_H_ +#include #include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -12,7 +13,6 @@ #include "sky/engine/wtf/HashMap.h" #include "sky/engine/wtf/HashSet.h" #include "sky/engine/wtf/OwnPtr.h" -#include "sky/engine/wtf/Vector.h" #include "sky/engine/wtf/text/WTFString.h" namespace blink { @@ -64,8 +64,8 @@ class DartLibraryLoader { Dart_Handle Import(Dart_Handle library, Dart_Handle url); Dart_Handle Source(Dart_Handle library, Dart_Handle url); Dart_Handle CanonicalizeURL(Dart_Handle library, Dart_Handle url); - void DidCompleteImportJob(ImportJob* job, const Vector& buffer); - void DidCompleteSourceJob(SourceJob* job, const Vector& buffer); + void DidCompleteImportJob(ImportJob* job, const std::vector& buffer); + void DidCompleteSourceJob(SourceJob* job, const std::vector& buffer); void DidFailJob(Job* job); DartState* dart_state_; diff --git a/engine/tonic/dart_snapshot_loader.cc b/engine/tonic/dart_snapshot_loader.cc index 04b4de01a75..9277da7ff01 100644 --- a/engine/tonic/dart_snapshot_loader.cc +++ b/engine/tonic/dart_snapshot_loader.cc @@ -32,7 +32,8 @@ void DartSnapshotLoader::LoadSnapshot(mojo::ScopedDataPipeConsumerHandle pipe, } void DartSnapshotLoader::OnDataAvailable(const void* data, size_t num_bytes) { - buffer_.append(static_cast(data), num_bytes); + const uint8_t* bytes = static_cast(data); + buffer_.insert(buffer_.end(), bytes, bytes + num_bytes); } void DartSnapshotLoader::OnDataComplete() { diff --git a/engine/tonic/dart_snapshot_loader.h b/engine/tonic/dart_snapshot_loader.h index 483299a3570..7817665cdae 100644 --- a/engine/tonic/dart_snapshot_loader.h +++ b/engine/tonic/dart_snapshot_loader.h @@ -5,13 +5,14 @@ #ifndef SKY_ENGINE_TONIC_DART_SNAPSHOT_LOADER_H_ #define SKY_ENGINE_TONIC_DART_SNAPSHOT_LOADER_H_ +#include + #include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "dart/runtime/include/dart_api.h" #include "mojo/common/data_pipe_drainer.h" #include "sky/engine/wtf/OwnPtr.h" -#include "sky/engine/wtf/Vector.h" #include "sky/engine/wtf/text/WTFString.h" namespace blink { @@ -33,7 +34,7 @@ class DartSnapshotLoader : public mojo::common::DataPipeDrainer::Client { base::WeakPtr dart_state_; OwnPtr drainer_; // TODO(abarth): Should we be using SharedBuffer to buffer the data? - Vector buffer_; + std::vector buffer_; base::Closure callback_; DISALLOW_COPY_AND_ASSIGN(DartSnapshotLoader);