Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Side by Side Diff: content/common/gpu/client/context_provider_command_buffer_browsertest.cc

Issue 199443004: gpu: Raise GL_OUT_OF_MEMORY when BeginQueryEXT fails to allocate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: checkmem: benchmark Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/gpu/browser_gpu_channel_host_factory.h" 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
6 #include "content/common/gpu/client/context_provider_command_buffer.h" 6 #include "content/common/gpu/client/context_provider_command_buffer.h"
7 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 7 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
8 #include "content/public/test/content_browser_test.h" 8 #include "content/public/test/content_browser_test.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 12 matching lines...) Expand all
23 CHECK(GetFactory()); 23 CHECK(GetFactory());
24 ContentBrowserTest::SetUpOnMainThread(); 24 ContentBrowserTest::SetUpOnMainThread();
25 } 25 }
26 26
27 protected: 27 protected:
28 BrowserGpuChannelHostFactory* GetFactory() { 28 BrowserGpuChannelHostFactory* GetFactory() {
29 return BrowserGpuChannelHostFactory::instance(); 29 return BrowserGpuChannelHostFactory::instance();
30 } 30 }
31 31
32 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext3d() { 32 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext3d() {
33 bool lose_context_when_out_of_memory = false;
33 scoped_refptr<GpuChannelHost> gpu_channel_host( 34 scoped_refptr<GpuChannelHost> gpu_channel_host(
34 GetFactory()->EstablishGpuChannelSync( 35 GetFactory()->EstablishGpuChannelSync(
35 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E)); 36 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E));
36 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( 37 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
37 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 38 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
38 gpu_channel_host.get(), 39 gpu_channel_host.get(),
39 blink::WebGraphicsContext3D::Attributes(), 40 blink::WebGraphicsContext3D::Attributes(),
41 lose_context_when_out_of_memory,
40 GURL("chrome://gpu/ContextProviderCommandBufferTest"), 42 GURL("chrome://gpu/ContextProviderCommandBufferTest"),
41 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), 43 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
42 NULL)); 44 NULL));
43 return context.Pass(); 45 return context.Pass();
44 } 46 }
45 }; 47 };
46 48
47 IN_PROC_BROWSER_TEST_F(ContextProviderCommandBufferBrowserTest, LeakOnDestroy) { 49 IN_PROC_BROWSER_TEST_F(ContextProviderCommandBufferBrowserTest, LeakOnDestroy) {
48 if (!BrowserGpuChannelHostFactory::CanUseForTesting()) 50 if (!BrowserGpuChannelHostFactory::CanUseForTesting())
49 return; 51 return;
50 52
51 scoped_refptr<ContextProviderCommandBuffer> provider = 53 scoped_refptr<ContextProviderCommandBuffer> provider =
52 ContextProviderCommandBuffer::Create(CreateContext3d(), "TestContext"); 54 ContextProviderCommandBuffer::Create(CreateContext3d(), "TestContext");
53 provider->set_leak_on_destroy(); 55 provider->set_leak_on_destroy();
54 EXPECT_TRUE(provider->BindToCurrentThread()); 56 EXPECT_TRUE(provider->BindToCurrentThread());
55 // This should not crash. 57 // This should not crash.
56 provider = NULL; 58 provider = NULL;
57 } 59 }
58 60
59 } // namespace 61 } // namespace
60 } // namespace content 62 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/image_transport_factory_android.cc ('k') | content/common/gpu/client/gl_helper_benchmark.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698