OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/proxy/proxy_resolver_v8.h" | 5 #include "net/proxy/proxy_resolver_v8.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstdio> | 8 #include <cstdio> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 729 |
730 // static | 730 // static |
731 v8::Isolate* ProxyResolverV8::GetDefaultIsolate() { | 731 v8::Isolate* ProxyResolverV8::GetDefaultIsolate() { |
732 DCHECK(g_default_isolate_) | 732 DCHECK(g_default_isolate_) |
733 << "Must call ProxyResolverV8::RememberDefaultIsolate() first"; | 733 << "Must call ProxyResolverV8::RememberDefaultIsolate() first"; |
734 return g_default_isolate_; | 734 return g_default_isolate_; |
735 } | 735 } |
736 | 736 |
737 v8::Isolate* ProxyResolverV8::g_default_isolate_ = NULL; | 737 v8::Isolate* ProxyResolverV8::g_default_isolate_ = NULL; |
738 | 738 |
| 739 // static |
| 740 size_t ProxyResolverV8::GetTotalHeapSize() { |
| 741 if (!g_default_isolate_) |
| 742 return 0; |
| 743 |
| 744 v8::Locker locked(g_default_isolate_); |
| 745 v8::HeapStatistics heap_statistics; |
| 746 g_default_isolate_->GetHeapStatistics(&heap_statistics); |
| 747 return heap_statistics.total_heap_size(); |
| 748 } |
| 749 |
| 750 // static |
| 751 size_t ProxyResolverV8::GetUsedHeapSize() { |
| 752 if (!g_default_isolate_) |
| 753 return 0; |
| 754 |
| 755 v8::Locker locked(g_default_isolate_); |
| 756 v8::HeapStatistics heap_statistics; |
| 757 g_default_isolate_->GetHeapStatistics(&heap_statistics); |
| 758 return heap_statistics.used_heap_size(); |
| 759 } |
| 760 |
739 } // namespace net | 761 } // namespace net |
OLD | NEW |