| 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 "config.h" | 5 #include "config.h" |
| 6 #include "bindings/core/v8/inspector/V8InjectedScriptHost.h" | 6 #include "bindings/core/v8/inspector/V8InjectedScriptHost.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/BindingSecurity.h" | 8 #include "bindings/core/v8/BindingSecurity.h" |
| 9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
| 10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 | 626 |
| 627 class WeakCallbackData final { | 627 class WeakCallbackData final { |
| 628 public: | 628 public: |
| 629 WeakCallbackData(v8::Isolate* isolate, PassRefPtrWillBeRawPtr<InjectedScript
Host> host, v8::Local<v8::Object> wrapper) | 629 WeakCallbackData(v8::Isolate* isolate, PassRefPtrWillBeRawPtr<InjectedScript
Host> host, v8::Local<v8::Object> wrapper) |
| 630 : m_host(host) | 630 : m_host(host) |
| 631 , m_persistent(isolate, wrapper) | 631 , m_persistent(isolate, wrapper) |
| 632 { | 632 { |
| 633 m_persistent.SetWeak(this, &WeakCallbackData::weakCallback, v8::WeakCall
backType::kParameter); | 633 m_persistent.SetWeak(this, &WeakCallbackData::weakCallback, v8::WeakCall
backType::kParameter); |
| 634 } | 634 } |
| 635 | 635 |
| 636 RefPtrWillBePersistent<InjectedScriptHost> m_host; | 636 // If kept as a strong Persistent<>, this back reference causes an Oilpan le
ak by |
| 637 // way of v8. Sidestep by using a raw pointer; InjectedScriptHost is slated
to |
| 638 // become a non-Oilpan object. |
| 639 GC_PLUGIN_IGNORE("466631") |
| 640 RefPtrWillBeRawPtr<InjectedScriptHost> m_host; |
| 637 | 641 |
| 638 private: | 642 private: |
| 639 static void weakCallback(const v8::WeakCallbackInfo<WeakCallbackData>& info) | 643 static void weakCallback(const v8::WeakCallbackInfo<WeakCallbackData>& info) |
| 640 { | 644 { |
| 641 delete info.GetParameter(); | 645 delete info.GetParameter(); |
| 642 } | 646 } |
| 643 | 647 |
| 644 v8::Global<v8::Object> m_persistent; | 648 v8::Global<v8::Object> m_persistent; |
| 645 }; | 649 }; |
| 646 | 650 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 void* data = value.As<v8::External>()->Value(); | 697 void* data = value.As<v8::External>()->Value(); |
| 694 return reinterpret_cast<WeakCallbackData*>(data)->m_host.get(); | 698 return reinterpret_cast<WeakCallbackData*>(data)->m_host.get(); |
| 695 } | 699 } |
| 696 | 700 |
| 697 v8::Local<v8::String> V8InjectedScriptHost::hiddenPropertyName(v8::Isolate* isol
ate) | 701 v8::Local<v8::String> V8InjectedScriptHost::hiddenPropertyName(v8::Isolate* isol
ate) |
| 698 { | 702 { |
| 699 return v8::String::NewFromUtf8(isolate, "v8inspector::InjectedScriptHost", v
8::NewStringType::kInternalized).ToLocalChecked(); | 703 return v8::String::NewFromUtf8(isolate, "v8inspector::InjectedScriptHost", v
8::NewStringType::kInternalized).ToLocalChecked(); |
| 700 } | 704 } |
| 701 | 705 |
| 702 } // namespace blink | 706 } // namespace blink |
| OLD | NEW |