2010-12-30 Mikhail Naganov <mnaganov@chromium.org>
authormnaganov@chromium.org <mnaganov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Dec 2010 13:04:56 +0000 (13:04 +0000)
committermnaganov@chromium.org <mnaganov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Dec 2010 13:04:56 +0000 (13:04 +0000)
        Reviewed by Pavel Feldman.

        Fix leak of MemoryInfo wrappers introduced in r57004 (see issue 51712).

        https://bugs.webkit.org/show_bug.cgi?id=51713

        * WebCore.gypi:
        * WebCore.pro:
        * bindings/v8/custom/V8ConsoleCustom.cpp:
        (WebCore::V8Console::memoryAccessorGetter):
        * bindings/v8/custom/V8PerformanceCustom.cpp: Copied from V8ConsoleCustom.cpp.
        (WebCore::V8Performance::memoryAccessorGetter):
        * page/Console.idl:
        * page/Performance.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74795 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/bindings/v8/custom/V8ConsoleCustom.cpp
WebCore/bindings/v8/custom/V8PerformanceCustom.cpp [new file with mode: 0644]
WebCore/page/Console.idl
WebCore/page/Performance.idl

index 5397fa9..0b10796 100644 (file)
@@ -1,3 +1,20 @@
+2010-12-30  Mikhail Naganov  <mnaganov@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Fix leak of MemoryInfo wrappers introduced in r57004 (see issue 51712).
+
+        https://bugs.webkit.org/show_bug.cgi?id=51713
+
+        * WebCore.gypi:
+        * WebCore.pro:
+        * bindings/v8/custom/V8ConsoleCustom.cpp:
+        (WebCore::V8Console::memoryAccessorGetter):
+        * bindings/v8/custom/V8PerformanceCustom.cpp: Copied from V8ConsoleCustom.cpp.
+        (WebCore::V8Performance::memoryAccessorGetter):
+        * page/Console.idl:
+        * page/Performance.idl:
+
 2010-12-30  Steve Block  <steveblock@google.com>
 
         Reviewed by Sam Weinig.
index ca94101..f0d0139 100644 (file)
             'bindings/v8/custom/V8NodeCustom.cpp',
             'bindings/v8/custom/V8NodeListCustom.cpp',
             'bindings/v8/custom/V8NotificationCenterCustom.cpp',
+            'bindings/v8/custom/V8PerformanceCustom.cpp',
             'bindings/v8/custom/V8PopStateEventCustom.cpp',
             'bindings/v8/custom/V8ScriptProfileCustom.cpp',
             'bindings/v8/custom/V8ScriptProfileNodeCustom.cpp',
index 0c5c01c..4311aa2 100644 (file)
@@ -470,6 +470,7 @@ v8 {
         bindings/v8/custom/V8NamedNodesCollection.cpp \
         bindings/v8/custom/V8NodeCustom.cpp \
         bindings/v8/custom/V8NodeListCustom.cpp \
+        bindings/v8/custom/V8PerformanceCustom.cpp \
         bindings/v8/custom/V8SQLResultSetRowListCustom.cpp \
         bindings/v8/custom/V8SQLTransactionCustom.cpp \
         bindings/v8/custom/V8WebSocketCustom.cpp \
index e21354e..40ff2b1 100644 (file)
@@ -39,6 +39,7 @@
 #include "ScriptProfile.h"
 #include "V8Binding.h"
 #include "V8BindingMacros.h"
+#include "V8MemoryInfo.h"
 #include "V8Proxy.h"
 #include "V8ScriptProfile.h"
 
@@ -108,4 +109,11 @@ v8::Handle<v8::Value> V8Console::profileEndCallback(const v8::Arguments& args)
 }
 #endif
 
+v8::Handle<v8::Value> V8Console::memoryAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    INC_STATS("DOM.Console.memoryAccessorGetter");
+    Console* imp = V8Console::toNative(info.Holder());
+    return toV8(imp->memory());
+}
+
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8PerformanceCustom.cpp b/WebCore/bindings/v8/custom/V8PerformanceCustom.cpp
new file mode 100644 (file)
index 0000000..95c0d5c
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "V8Performance.h"
+
+#include "Performance.h"
+#include "V8Binding.h"
+#include "V8BindingMacros.h"
+#include "V8MemoryInfo.h"
+
+namespace WebCore {
+
+v8::Handle<v8::Value> V8Performance::memoryAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    INC_STATS("DOM.Performance.memoryAccessorGetter");
+    Performance* imp = V8Performance::toNative(info.Holder());
+    return toV8(imp->memory());
+}
+
+} // namespace WebCore
index 9f03911..503bb91 100644 (file)
@@ -58,7 +58,7 @@ module window {
         [CustomArgumentHandling] void groupCollapsed();
         void groupEnd();
 
-        readonly attribute MemoryInfo memory;
+        readonly attribute [V8CustomGetter] MemoryInfo memory;
     };
 
 }
index c72f4bc..e5a8dcf 100644 (file)
@@ -34,7 +34,7 @@ module window {
     interface [Conditional=WEB_TIMING, OmitConstructor] Performance {
         readonly attribute PerformanceNavigation navigation;
         readonly attribute PerformanceTiming timing;
-        readonly attribute MemoryInfo memory;
+        readonly attribute [V8CustomGetter] MemoryInfo memory;
     };
 
 }