Title: [111216] trunk/Source
Revision
111216
Author
[email protected]
Date
2012-03-19 12:19:12 -0700 (Mon, 19 Mar 2012)

Log Message

[chromium] Updating WebGraphicsContext3D MemoryAllocation callback to accept a struct with have backbuffer suggestion.
https://bugs.webkit.org/show_bug.cgi?id=81279

Patch by Michal Mocny <[email protected]> on 2012-03-19
Reviewed by James Robinson.

Source/Platform:

Adding a suggestHaveBackbuffer hint to the WebGraphicsContext3D memory allocation callback.

* chromium/public/WebGraphicsContext3D.h:
(WebGraphicsMemoryAllocationChangedCallbackCHROMIUM):
(WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM::onMemoryAllocationChanged):
* chromium/public/WebGraphicsMemoryAllocation.h: Added.
(WebKit):
(WebGraphicsMemoryAllocation):
(WebKit::WebGraphicsMemoryAllocation::WebGraphicsMemoryAllocation):

Source/WebCore:

* platform/graphics/chromium/Extensions3DChromium.h:
(GpuMemoryAllocationCHROMIUM):
(WebCore::Extensions3DChromium::GpuMemoryAllocationCHROMIUM::GpuMemoryAllocationCHROMIUM):
(GpuMemoryAllocationChangedCallbackCHROMIUM):

Source/WebKit/chromium:

* src/GraphicsContext3DChromium.cpp:
(WebCore::GrMemoryAllocationChangedCallback::onGpuMemoryAllocationChanged):
(WebCore::GraphicsContext3DMemoryAllocationChangedCallbackAdapter::onMemoryAllocationChanged):
(GraphicsContext3DMemoryAllocationChangedCallbackAdapter):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (111215 => 111216)


--- trunk/Source/Platform/ChangeLog	2012-03-19 19:14:03 UTC (rev 111215)
+++ trunk/Source/Platform/ChangeLog	2012-03-19 19:19:12 UTC (rev 111216)
@@ -1,3 +1,20 @@
+2012-03-19  Michal Mocny  <[email protected]>
+
+        [chromium] Updating WebGraphicsContext3D MemoryAllocation callback to accept a struct with have backbuffer suggestion.
+        https://bugs.webkit.org/show_bug.cgi?id=81279
+
+        Reviewed by James Robinson.
+
+        Adding a suggestHaveBackbuffer hint to the WebGraphicsContext3D memory allocation callback.
+
+        * chromium/public/WebGraphicsContext3D.h:
+        (WebGraphicsMemoryAllocationChangedCallbackCHROMIUM):
+        (WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM::onMemoryAllocationChanged):
+        * chromium/public/WebGraphicsMemoryAllocation.h: Added.
+        (WebKit):
+        (WebGraphicsMemoryAllocation):
+        (WebKit::WebGraphicsMemoryAllocation::WebGraphicsMemoryAllocation):
+
 2012-03-19  David Reveman  <[email protected]>
 
         [Chromium] GL_EXT_occlusion_query_boolean and GL_CHROMIUM_command_buffer_query support.

Modified: trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h (111215 => 111216)


--- trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h	2012-03-19 19:14:03 UTC (rev 111215)
+++ trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h	2012-03-19 19:19:12 UTC (rev 111216)
@@ -32,6 +32,7 @@
 #define WebGraphicsContext3D_h
 
 #include "WebCommon.h"
+#include "WebGraphicsMemoryAllocation.h"
 #include "WebNonCopyable.h"
 #include "WebString.h"
 
@@ -129,7 +130,10 @@
 
     class WebGraphicsMemoryAllocationChangedCallbackCHROMIUM {
     public:
+        // FIXME: Remove this once we switch to WebGraphicsMemoryAllocation version.
         virtual void onMemoryAllocationChanged(size_t gpuResourceSizeInBytes) = 0;
+        // FIXME: Make this pure virtual once we implement everywhere.
+        virtual void onMemoryAllocationChanged(WebGraphicsMemoryAllocation) { }
 
     protected:
         virtual ~WebGraphicsMemoryAllocationChangedCallbackCHROMIUM() { }

Added: trunk/Source/Platform/chromium/public/WebGraphicsMemoryAllocation.h (0 => 111216)


--- trunk/Source/Platform/chromium/public/WebGraphicsMemoryAllocation.h	                        (rev 0)
+++ trunk/Source/Platform/chromium/public/WebGraphicsMemoryAllocation.h	2012-03-19 19:19:12 UTC (rev 111216)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 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:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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.
+ */
+
+#ifndef WebGraphicsMemoryAllocation_h
+#define WebGraphicsMemoryAllocation_h
+
+#include "WebCommon.h"
+
+namespace WebKit {
+
+struct WebGraphicsMemoryAllocation {
+    unsigned gpuResourceSizeInBytes;
+    bool suggestHaveBackbuffer;
+
+    WebGraphicsMemoryAllocation()
+        : gpuResourceSizeInBytes(0)
+        , suggestHaveBackbuffer(false)
+    {
+    }
+
+    WebGraphicsMemoryAllocation(unsigned gpuResourceSizeInBytes, bool suggestHaveBackbuffer)
+        : gpuResourceSizeInBytes(gpuResourceSizeInBytes)
+        , suggestHaveBackbuffer(suggestHaveBackbuffer)
+    {
+    }
+};
+
+} // namespace WebKit
+
+#endif
+

Modified: trunk/Source/WebCore/ChangeLog (111215 => 111216)


--- trunk/Source/WebCore/ChangeLog	2012-03-19 19:14:03 UTC (rev 111215)
+++ trunk/Source/WebCore/ChangeLog	2012-03-19 19:19:12 UTC (rev 111216)
@@ -1,3 +1,15 @@
+2012-03-19  Michal Mocny  <[email protected]>
+
+        [chromium] Updating WebGraphicsContext3D MemoryAllocation callback to accept a struct with have backbuffer suggestion.
+        https://bugs.webkit.org/show_bug.cgi?id=81279
+
+        Reviewed by James Robinson.
+
+        * platform/graphics/chromium/Extensions3DChromium.h:
+        (GpuMemoryAllocationCHROMIUM):
+        (WebCore::Extensions3DChromium::GpuMemoryAllocationCHROMIUM::GpuMemoryAllocationCHROMIUM):
+        (GpuMemoryAllocationChangedCallbackCHROMIUM):
+
 2012-03-19  Tony Chang  <[email protected]>
 
         flex-item-align: stretch should only grow, never shrink

Modified: trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h (111215 => 111216)


--- trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h	2012-03-19 19:14:03 UTC (rev 111215)
+++ trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h	2012-03-19 19:19:12 UTC (rev 111216)
@@ -103,9 +103,20 @@
     void setVisibilityCHROMIUM(bool);
 
     // GL_CHROMIUM_gpu_memory_manager
+    struct GpuMemoryAllocationCHROMIUM {
+        size_t gpuResourceSizeInBytes;
+        bool suggestHaveBackbuffer;
+
+        GpuMemoryAllocationCHROMIUM(size_t gpuResourceSizeInBytes, bool suggestHaveBackbuffer)
+            : gpuResourceSizeInBytes(gpuResourceSizeInBytes)
+            , suggestHaveBackbuffer(suggestHaveBackbuffer)
+        {
+        }
+    };
     class GpuMemoryAllocationChangedCallbackCHROMIUM {
     public:
-        virtual void onGpuMemoryAllocationChanged(size_t gpuResourceSizeInBytes) = 0;
+
+        virtual void onGpuMemoryAllocationChanged(GpuMemoryAllocationCHROMIUM) = 0;
         virtual ~GpuMemoryAllocationChangedCallbackCHROMIUM() { }
     };
     void setGpuMemoryAllocationChangedCallbackCHROMIUM(PassOwnPtr<GpuMemoryAllocationChangedCallbackCHROMIUM>);

Modified: trunk/Source/WebKit/chromium/ChangeLog (111215 => 111216)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-19 19:14:03 UTC (rev 111215)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-19 19:19:12 UTC (rev 111216)
@@ -1,3 +1,15 @@
+2012-03-19  Michal Mocny  <[email protected]>
+
+        [chromium] Updating WebGraphicsContext3D MemoryAllocation callback to accept a struct with have backbuffer suggestion.
+        https://bugs.webkit.org/show_bug.cgi?id=81279
+
+        Reviewed by James Robinson.
+
+        * src/GraphicsContext3DChromium.cpp:
+        (WebCore::GrMemoryAllocationChangedCallback::onGpuMemoryAllocationChanged):
+        (WebCore::GraphicsContext3DMemoryAllocationChangedCallbackAdapter::onMemoryAllocationChanged):
+        (GraphicsContext3DMemoryAllocationChangedCallbackAdapter):
+
 2012-03-19  David Reveman  <[email protected]>
 
         [Chromium] GL_EXT_occlusion_query_boolean and GL_CHROMIUM_command_buffer_query support.

Modified: trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp (111215 => 111216)


--- trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp	2012-03-19 19:14:03 UTC (rev 111215)
+++ trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp	2012-03-19 19:19:12 UTC (rev 111216)
@@ -174,13 +174,13 @@
     {
     }
 
-    virtual void onGpuMemoryAllocationChanged(size_t gpuResourceSizeInBytes)
+    virtual void onGpuMemoryAllocationChanged(Extensions3DChromium::GpuMemoryAllocationCHROMIUM allocation)
     {
         GrContext* context = m_context->grContext();
         if (!context)
             return;
 
-        if (!gpuResourceSizeInBytes) {
+        if (!allocation.gpuResourceSizeInBytes) {
             context->freeGpuResources();
             context->setTextureCacheLimits(0, 0);
         } else
@@ -1368,8 +1368,14 @@
 
     virtual void onMemoryAllocationChanged(size_t gpuResourceSizeInBytes)
     {
+        // FIXME: Remove this once clients start using WebGraphicsMemoryAllocation exclusively.
+        onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation(gpuResourceSizeInBytes, true));
+    }
+
+    virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation allocation)
+    {
         if (m_memoryAllocationChangedCallback)
-            m_memoryAllocationChangedCallback->onGpuMemoryAllocationChanged(gpuResourceSizeInBytes);
+            m_memoryAllocationChangedCallback->onGpuMemoryAllocationChanged(Extensions3DChromium::GpuMemoryAllocationCHROMIUM(allocation.gpuResourceSizeInBytes, allocation.suggestHaveBackbuffer));
     }
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to