| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tonic/dart_snapshot_loader.h" | 5 #include "tonic/dart_snapshot_loader.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "tonic/dart_api_scope.h" | 9 #include "tonic/dart_api_scope.h" |
| 10 #include "tonic/dart_converter.h" | 10 #include "tonic/dart_converter.h" |
| 11 #include "tonic/dart_error.h" | 11 #include "tonic/dart_error.h" |
| 12 #include "tonic/dart_isolate_scope.h" | 12 #include "tonic/dart_isolate_scope.h" |
| 13 | 13 |
| 14 using mojo::common::DataPipeDrainer; | 14 using mojo::common::DataPipeDrainer; |
| 15 | 15 |
| 16 namespace blink { | 16 namespace tonic { |
| 17 | 17 |
| 18 DartSnapshotLoader::DartSnapshotLoader(DartState* dart_state) | 18 DartSnapshotLoader::DartSnapshotLoader(DartState* dart_state) |
| 19 : dart_state_(dart_state->GetWeakPtr()) { | 19 : dart_state_(dart_state->GetWeakPtr()) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 DartSnapshotLoader::~DartSnapshotLoader() { | 22 DartSnapshotLoader::~DartSnapshotLoader() { |
| 23 } | 23 } |
| 24 | 24 |
| 25 void DartSnapshotLoader::LoadSnapshot(mojo::ScopedDataPipeConsumerHandle pipe, | 25 void DartSnapshotLoader::LoadSnapshot(mojo::ScopedDataPipeConsumerHandle pipe, |
| 26 const base::Closure& callback) { | 26 const base::Closure& callback) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 42 { | 42 { |
| 43 DartIsolateScope scope(dart_state_->isolate()); | 43 DartIsolateScope scope(dart_state_->isolate()); |
| 44 DartApiScope api_scope; | 44 DartApiScope api_scope; |
| 45 | 45 |
| 46 LogIfError(Dart_LoadScriptFromSnapshot(buffer_.data(), buffer_.size())); | 46 LogIfError(Dart_LoadScriptFromSnapshot(buffer_.data(), buffer_.size())); |
| 47 } | 47 } |
| 48 | 48 |
| 49 callback_.Run(); | 49 callback_.Run(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace blink | 52 } // namespace tonic |
| OLD | NEW |