OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 "test/inspector/inspector-impl.h" | 5 #include "test/inspector/inspector-impl.h" |
6 | 6 |
7 #include "include/v8.h" | 7 #include "include/v8.h" |
8 | 8 |
9 #include "src/vector.h" | 9 #include "src/vector.h" |
10 | 10 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 v8::base::Semaphore* ready_semaphore) { | 155 v8::base::Semaphore* ready_semaphore) { |
156 task_runner_->Append(new DisconnectTask(this)); | 156 task_runner_->Append(new DisconnectTask(this)); |
157 task_runner_->Append(new ConnectTask(this, ready_semaphore)); | 157 task_runner_->Append(new ConnectTask(this, ready_semaphore)); |
158 } | 158 } |
159 | 159 |
160 void InspectorClientImpl::disconnect() { | 160 void InspectorClientImpl::disconnect() { |
161 state_ = session_->stateJSON(); | 161 state_ = session_->stateJSON(); |
162 session_.reset(); | 162 session_.reset(); |
163 } | 163 } |
164 | 164 |
| 165 bool InspectorClientImpl::formatAccessorsAsProperties( |
| 166 v8::Local<v8::Value> object) { |
| 167 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 168 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
| 169 v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi( |
| 170 isolate, v8::String::NewFromUtf8(isolate, "allowAccessorFormatting", |
| 171 v8::NewStringType::kNormal) |
| 172 .ToLocalChecked()); |
| 173 CHECK(object->IsObject()); |
| 174 return object.As<v8::Object>() |
| 175 ->HasPrivate(context, shouldFormatAccessorsPrivate) |
| 176 .FromMaybe(false); |
| 177 } |
| 178 |
165 v8::Local<v8::Context> InspectorClientImpl::ensureDefaultContextInGroup(int) { | 179 v8::Local<v8::Context> InspectorClientImpl::ensureDefaultContextInGroup(int) { |
166 CHECK(isolate_); | 180 CHECK(isolate_); |
167 return context_.Get(isolate_); | 181 return context_.Get(isolate_); |
168 } | 182 } |
169 | 183 |
170 void InspectorClientImpl::setCurrentTimeMSForTest(double time) { | 184 void InspectorClientImpl::setCurrentTimeMSForTest(double time) { |
171 current_time_ = time; | 185 current_time_ = time; |
172 current_time_set_for_test_ = true; | 186 current_time_set_for_test_ = true; |
173 } | 187 } |
174 | 188 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 isolate, SendMessageToBackendExtension::SendMessageToBackend); | 243 isolate, SendMessageToBackendExtension::SendMessageToBackend); |
230 } | 244 } |
231 | 245 |
232 void SendMessageToBackendExtension::SendMessageToBackend( | 246 void SendMessageToBackendExtension::SendMessageToBackend( |
233 const v8::FunctionCallbackInfo<v8::Value>& args) { | 247 const v8::FunctionCallbackInfo<v8::Value>& args) { |
234 CHECK(backend_task_runner_); | 248 CHECK(backend_task_runner_); |
235 CHECK(args.Length() == 1 && args[0]->IsString()); | 249 CHECK(args.Length() == 1 && args[0]->IsString()); |
236 v8::Local<v8::String> message = args[0].As<v8::String>(); | 250 v8::Local<v8::String> message = args[0].As<v8::String>(); |
237 backend_task_runner_->Append(new SendMessageToBackendTask(ToVector(message))); | 251 backend_task_runner_->Append(new SendMessageToBackendTask(ToVector(message))); |
238 } | 252 } |
OLD | NEW |