| 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 "src/inspector/V8InternalValueType.h" | 5 #include "src/inspector/V8InternalValueType.h" |
| 6 | 6 |
| 7 #include "src/inspector/ProtocolPlatform.h" | 7 #include "src/inspector/ProtocolPlatform.h" |
| 8 #include "src/inspector/StringUtil.h" | 8 #include "src/inspector/StringUtil.h" |
| 9 | 9 |
| 10 namespace v8_inspector { | 10 namespace v8_inspector { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 v8::Local<v8::String> subtype = subtypeForInternalType(isolate, type); | 42 v8::Local<v8::String> subtype = subtypeForInternalType(isolate, type); |
| 43 return object->SetPrivate(context, privateValue, subtype).FromMaybe(false); | 43 return object->SetPrivate(context, privateValue, subtype).FromMaybe(false); |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool markArrayEntriesAsInternal(v8::Local<v8::Context> context, | 46 bool markArrayEntriesAsInternal(v8::Local<v8::Context> context, |
| 47 v8::Local<v8::Array> array, | 47 v8::Local<v8::Array> array, |
| 48 V8InternalValueType type) { | 48 V8InternalValueType type) { |
| 49 v8::Isolate* isolate = context->GetIsolate(); | 49 v8::Isolate* isolate = context->GetIsolate(); |
| 50 v8::Local<v8::Private> privateValue = internalSubtypePrivate(isolate); | 50 v8::Local<v8::Private> privateValue = internalSubtypePrivate(isolate); |
| 51 v8::Local<v8::String> subtype = subtypeForInternalType(isolate, type); | 51 v8::Local<v8::String> subtype = subtypeForInternalType(isolate, type); |
| 52 for (uint32_t i = 0; i < array->Length(); ++i) { | 52 for (size_t i = 0; i < array->Length(); ++i) { |
| 53 v8::Local<v8::Value> entry; | 53 v8::Local<v8::Value> entry; |
| 54 if (!array->Get(context, i).ToLocal(&entry) || !entry->IsObject()) | 54 if (!array->Get(context, i).ToLocal(&entry) || !entry->IsObject()) |
| 55 return false; | 55 return false; |
| 56 if (!entry.As<v8::Object>() | 56 if (!entry.As<v8::Object>() |
| 57 ->SetPrivate(context, privateValue, subtype) | 57 ->SetPrivate(context, privateValue, subtype) |
| 58 .FromMaybe(false)) | 58 .FromMaybe(false)) |
| 59 return false; | 59 return false; |
| 60 } | 60 } |
| 61 return true; | 61 return true; |
| 62 } | 62 } |
| 63 | 63 |
| 64 v8::Local<v8::Value> v8InternalValueTypeFrom(v8::Local<v8::Context> context, | 64 v8::Local<v8::Value> v8InternalValueTypeFrom(v8::Local<v8::Context> context, |
| 65 v8::Local<v8::Object> object) { | 65 v8::Local<v8::Object> object) { |
| 66 v8::Isolate* isolate = context->GetIsolate(); | 66 v8::Isolate* isolate = context->GetIsolate(); |
| 67 v8::Local<v8::Private> privateValue = internalSubtypePrivate(isolate); | 67 v8::Local<v8::Private> privateValue = internalSubtypePrivate(isolate); |
| 68 if (!object->HasPrivate(context, privateValue).FromMaybe(false)) | 68 if (!object->HasPrivate(context, privateValue).FromMaybe(false)) |
| 69 return v8::Null(isolate); | 69 return v8::Null(isolate); |
| 70 v8::Local<v8::Value> subtypeValue; | 70 v8::Local<v8::Value> subtypeValue; |
| 71 if (!object->GetPrivate(context, privateValue).ToLocal(&subtypeValue) || | 71 if (!object->GetPrivate(context, privateValue).ToLocal(&subtypeValue) || |
| 72 !subtypeValue->IsString()) | 72 !subtypeValue->IsString()) |
| 73 return v8::Null(isolate); | 73 return v8::Null(isolate); |
| 74 return subtypeValue; | 74 return subtypeValue; |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace v8_inspector | 77 } // namespace v8_inspector |
| OLD | NEW |