Chromium Code Reviews| Index: sky/engine/core/script/dart_debugger.cc |
| diff --git a/mojo/dart/embedder/dart_debugger.cc b/sky/engine/core/script/dart_debugger.cc |
| similarity index 88% |
| copy from mojo/dart/embedder/dart_debugger.cc |
| copy to sky/engine/core/script/dart_debugger.cc |
| index 31e9ee4b5fb9a6534eccf618e5a56dd98842cd8c..310428fb79719ea2c9d0a776ad1b47568d2205cd 100644 |
| --- a/mojo/dart/embedder/dart_debugger.cc |
| +++ b/sky/engine/core/script/dart_debugger.cc |
| @@ -7,10 +7,9 @@ |
| #include "dart/runtime/include/dart_api.h" |
| #include "dart/runtime/include/dart_debugger_api.h" |
| #include "dart/runtime/include/dart_native_api.h" |
| -#include "mojo/dart/embedder/dart_debugger.h" |
| +#include "dart_debugger.h" |
| -namespace mojo { |
| -namespace dart { |
| +namespace blink { |
| void DartDebuggerIsolate::MessageLoop() { |
| MonitorLocker ml(&monitor_); |
| @@ -98,6 +97,7 @@ void DartDebugger::InitDebugger() { |
| Dart_SetBreakpointResolvedHandler(BptResolvedHandler); |
| Dart_SetExceptionThrownHandler(ExceptionThrownHandler); |
| lock_ = new base::Lock(); |
| + isolates_ = new std::vector<DartDebuggerIsolate*>(); |
|
eseidel
2015/05/06 17:46:40
Sky would probably use Vector<OwnPtr<DartDebuggerI
abarth-chromium
2015/05/06 20:34:23
Now with C++11 we can do std::vector<std::unique_p
Cutch
2015/05/06 22:36:49
Done.
|
| } |
| DartDebuggerIsolate* DartDebugger::FindIsolateById(Dart_IsolateId id) { |
| @@ -108,8 +108,8 @@ DartDebuggerIsolate* DartDebugger::FindIsolateById(Dart_IsolateId id) { |
| DartDebuggerIsolate* DartDebugger::FindIsolateByIdLocked( |
| Dart_IsolateId id) { |
| lock_->AssertAcquired(); |
| - for (size_t i = 0; i < isolates_.size(); i++) { |
| - DartDebuggerIsolate* isolate = isolates_[i]; |
| + for (size_t i = 0; i < isolates_->size(); i++) { |
| + DartDebuggerIsolate* isolate = (*isolates_)[i]; |
| if (id == isolate->id()) { |
| return isolate; |
| } |
| @@ -122,16 +122,17 @@ DartDebuggerIsolate* DartDebugger::AddIsolate(Dart_IsolateId id) { |
| CHECK(FindIsolateByIdLocked(id) == nullptr); |
| DartDebuggerIsolate* debugger_isolate = |
| new DartDebuggerIsolate(id); |
| - isolates_.push_back(debugger_isolate); |
| + isolates_->push_back(debugger_isolate); |
| return debugger_isolate; |
| } |
| void DartDebugger::RemoveIsolate(Dart_IsolateId id) { |
| base::AutoLock al(*lock_); |
| - for (size_t i = 0; i < isolates_.size(); i++) { |
| - DartDebuggerIsolate* isolate = isolates_[i]; |
| + for (size_t i = 0; i < isolates_->size(); i++) { |
| + DartDebuggerIsolate* isolate = (*isolates_)[i]; |
| if (id == isolate->id()) { |
| - isolates_.erase(isolates_.begin() + i); |
| + isolates_->erase(isolates_->begin() + i); |
| + delete isolate; |
|
eseidel
2015/05/06 17:46:40
My complaint above is really about this line. Own
abarth-chromium
2015/05/06 20:34:23
s/auto_ptr/unique_ptr/
Cutch
2015/05/06 22:36:49
Done.
|
| return; |
| } |
| } |
| @@ -139,7 +140,6 @@ void DartDebugger::RemoveIsolate(Dart_IsolateId id) { |
| } |
| base::Lock* DartDebugger::lock_ = nullptr; |
| -std::vector<DartDebuggerIsolate*> DartDebugger::isolates_; |
| +std::vector<DartDebuggerIsolate*>* DartDebugger::isolates_ = nullptr; |
| -} // namespace apps |
| -} // namespace mojo |
| +} // namespace blink |