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

Side by Side Diff: content/browser/gpu/gpu_ipc_browsertests.cc

Issue 226423002: Merge 261120 "gpu: Lose context when BeginQueryEXT fails to allo..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1916/src/
Patch Set: 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 7 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
8 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 8 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
9 #include "content/common/gpu/client/context_provider_command_buffer.h" 9 #include "content/common/gpu/client/context_provider_command_buffer.h"
10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
(...skipping 17 matching lines...) Expand all
28 virtual void SetUpOnMainThread() OVERRIDE { 28 virtual void SetUpOnMainThread() OVERRIDE {
29 if (!content::BrowserGpuChannelHostFactory::CanUseForTesting()) 29 if (!content::BrowserGpuChannelHostFactory::CanUseForTesting())
30 return; 30 return;
31 31
32 if (!content::BrowserGpuChannelHostFactory::instance()) 32 if (!content::BrowserGpuChannelHostFactory::instance())
33 content::BrowserGpuChannelHostFactory::Initialize(true); 33 content::BrowserGpuChannelHostFactory::Initialize(true);
34 34
35 content::BrowserGpuChannelHostFactory* factory = 35 content::BrowserGpuChannelHostFactory* factory =
36 content::BrowserGpuChannelHostFactory::instance(); 36 content::BrowserGpuChannelHostFactory::instance();
37 CHECK(factory); 37 CHECK(factory);
38 bool lose_context_when_out_of_memory = false;
38 scoped_refptr<content::GpuChannelHost> gpu_channel_host( 39 scoped_refptr<content::GpuChannelHost> gpu_channel_host(
39 factory->EstablishGpuChannelSync(kInitCause)); 40 factory->EstablishGpuChannelSync(kInitCause));
40 context_.reset( 41 context_.reset(
41 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 42 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
42 gpu_channel_host.get(), 43 gpu_channel_host.get(),
43 blink::WebGraphicsContext3D::Attributes(), 44 blink::WebGraphicsContext3D::Attributes(),
45 lose_context_when_out_of_memory,
44 GURL(), 46 GURL(),
45 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), 47 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
46 NULL)); 48 NULL));
47 CHECK(context_.get()); 49 CHECK(context_.get());
48 context_->makeContextCurrent(); 50 context_->makeContextCurrent();
49 context_support_ = context_->GetContextSupport(); 51 context_support_ = context_->GetContextSupport();
50 ContentBrowserTest::SetUpOnMainThread(); 52 ContentBrowserTest::SetUpOnMainThread();
51 } 53 }
52 54
53 virtual void TearDownOnMainThread() OVERRIDE { 55 virtual void TearDownOnMainThread() OVERRIDE {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 GpuChannelHost* GetGpuChannel() { 120 GpuChannelHost* GetGpuChannel() {
119 return GetFactory()->GetGpuChannel(); 121 return GetFactory()->GetGpuChannel();
120 } 122 }
121 123
122 static void Signal(bool *event) { 124 static void Signal(bool *event) {
123 CHECK_EQ(*event, false); 125 CHECK_EQ(*event, false);
124 *event = true; 126 *event = true;
125 } 127 }
126 128
127 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() { 129 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() {
130 bool lose_context_when_out_of_memory = false;
128 return make_scoped_ptr( 131 return make_scoped_ptr(
129 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 132 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
130 GetGpuChannel(), 133 GetGpuChannel(),
131 blink::WebGraphicsContext3D::Attributes(), 134 blink::WebGraphicsContext3D::Attributes(),
135 lose_context_when_out_of_memory,
132 GURL(), 136 GURL(),
133 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), 137 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
134 NULL)); 138 NULL));
135 } 139 }
136 }; 140 };
137 141
138 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, Basic) { 142 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, Basic) {
139 if (!context_) 143 if (!context_)
140 return; 144 return;
141 145
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 shim->SimulateCrash(); 202 shim->SimulateCrash();
199 run_loop.Run(); 203 run_loop.Run();
200 204
201 EXPECT_EQ(1, counter); 205 EXPECT_EQ(1, counter);
202 EXPECT_FALSE(IsChannelEstablished()); 206 EXPECT_FALSE(IsChannelEstablished());
203 EstablishAndWait(); 207 EstablishAndWait();
204 EXPECT_TRUE(IsChannelEstablished()); 208 EXPECT_TRUE(IsChannelEstablished());
205 } 209 }
206 210
207 } // namespace content 211 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.cc ('k') | content/browser/renderer_host/compositor_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698