| OLD | NEW |
| 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 9 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 9 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 10 #include "content/common/gpu/client/context_provider_command_buffer.h" | 10 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 CHECK(factory); | 41 CHECK(factory); |
| 42 bool lose_context_when_out_of_memory = false; | 42 bool lose_context_when_out_of_memory = false; |
| 43 base::RunLoop run_loop; | 43 base::RunLoop run_loop; |
| 44 factory->EstablishGpuChannel(kInitCause, run_loop.QuitClosure()); | 44 factory->EstablishGpuChannel(kInitCause, run_loop.QuitClosure()); |
| 45 run_loop.Run(); | 45 run_loop.Run(); |
| 46 scoped_refptr<content::GpuChannelHost> | 46 scoped_refptr<content::GpuChannelHost> |
| 47 gpu_channel_host(factory->GetGpuChannel()); | 47 gpu_channel_host(factory->GetGpuChannel()); |
| 48 DCHECK(gpu_channel_host.get()); | 48 DCHECK(gpu_channel_host.get()); |
| 49 context_.reset( | 49 context_.reset( |
| 50 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 50 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 51 gpu_channel_host.get(), | 51 gpu_channel_host.get(), blink::WebGraphicsContext3D::Attributes(), |
| 52 blink::WebGraphicsContext3D::Attributes(), | 52 lose_context_when_out_of_memory, std::string(), |
| 53 lose_context_when_out_of_memory, | 53 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), NULL)); |
| 54 GURL(), | |
| 55 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), | |
| 56 NULL)); | |
| 57 CHECK(context_.get()); | 54 CHECK(context_.get()); |
| 58 context_->InitializeOnCurrentThread(); | 55 context_->InitializeOnCurrentThread(); |
| 59 context_support_ = context_->GetContextSupport(); | 56 context_support_ = context_->GetContextSupport(); |
| 60 ContentBrowserTest::SetUpOnMainThread(); | 57 ContentBrowserTest::SetUpOnMainThread(); |
| 61 } | 58 } |
| 62 | 59 |
| 63 void TearDownOnMainThread() override { | 60 void TearDownOnMainThread() override { |
| 64 // Must delete the context first. | 61 // Must delete the context first. |
| 65 context_.reset(NULL); | 62 context_.reset(NULL); |
| 66 ContentBrowserTest::TearDownOnMainThread(); | 63 ContentBrowserTest::TearDownOnMainThread(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 124 |
| 128 static void Signal(bool *event) { | 125 static void Signal(bool *event) { |
| 129 CHECK_EQ(*event, false); | 126 CHECK_EQ(*event, false); |
| 130 *event = true; | 127 *event = true; |
| 131 } | 128 } |
| 132 | 129 |
| 133 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() { | 130 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() { |
| 134 bool lose_context_when_out_of_memory = false; | 131 bool lose_context_when_out_of_memory = false; |
| 135 return make_scoped_ptr( | 132 return make_scoped_ptr( |
| 136 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 133 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 137 GetGpuChannel(), | 134 GetGpuChannel(), blink::WebGraphicsContext3D::Attributes(), |
| 138 blink::WebGraphicsContext3D::Attributes(), | 135 lose_context_when_out_of_memory, std::string(), |
| 139 lose_context_when_out_of_memory, | 136 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), NULL)); |
| 140 GURL(), | |
| 141 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), | |
| 142 NULL)); | |
| 143 } | 137 } |
| 144 }; | 138 }; |
| 145 | 139 |
| 146 // Test fails on Chromeos + Mac, flaky on Windows because UI Compositor | 140 // Test fails on Chromeos + Mac, flaky on Windows because UI Compositor |
| 147 // establishes a GPU channel. | 141 // establishes a GPU channel. |
| 148 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 142 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 149 #define MAYBE_Basic Basic | 143 #define MAYBE_Basic Basic |
| 150 #else | 144 #else |
| 151 #define MAYBE_Basic DISABLED_Basic | 145 #define MAYBE_Basic DISABLED_Basic |
| 152 #endif | 146 #endif |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 shim->SimulateCrash(); | 266 shim->SimulateCrash(); |
| 273 run_loop.Run(); | 267 run_loop.Run(); |
| 274 | 268 |
| 275 EXPECT_EQ(1, counter); | 269 EXPECT_EQ(1, counter); |
| 276 EXPECT_FALSE(IsChannelEstablished()); | 270 EXPECT_FALSE(IsChannelEstablished()); |
| 277 EstablishAndWait(); | 271 EstablishAndWait(); |
| 278 EXPECT_TRUE(IsChannelEstablished()); | 272 EXPECT_TRUE(IsChannelEstablished()); |
| 279 } | 273 } |
| 280 | 274 |
| 281 } // namespace content | 275 } // namespace content |
| OLD | NEW |