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

Unified Diff: content/child/child_thread_impl_browsertest.cc

Issue 1171293005: Revert of content: Single process support for native GpuMemoryBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dm-browsertests-refactor
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/in_process_io_surface_manager_mac.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl_browsertest.cc
diff --git a/content/child/child_thread_impl_browsertest.cc b/content/child/child_thread_impl_browsertest.cc
index 96b1f5207961fabfef0e44d908a58c8cd2844ed7..4a37196d77d9dbe9812911763e9f6e7c9765af61 100644
--- a/content/child/child_thread_impl_browsertest.cc
+++ b/content/child/child_thread_impl_browsertest.cc
@@ -8,9 +8,7 @@
#include "base/memory/scoped_vector.h"
#include "base/time/time.h"
#include "content/child/child_discardable_shared_memory_manager.h"
-#include "content/child/child_gpu_memory_buffer_manager.h"
#include "content/child/child_thread_impl.h"
-#include "content/common/gpu/client/gpu_memory_buffer_impl.h"
#include "content/common/host_discardable_shared_memory_manager.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/content_browser_test.h"
@@ -19,13 +17,11 @@
#include "url/gurl.h"
namespace content {
-namespace {
class ChildThreadImplBrowserTest : public ContentBrowserTest {
public:
ChildThreadImplBrowserTest()
- : child_gpu_memory_buffer_manager_(nullptr),
- child_discardable_shared_memory_manager_(nullptr) {}
+ : child_discardable_shared_memory_manager_(nullptr) {}
// Overridden from BrowserTestBase:
void SetUpCommandLine(base::CommandLine* command_line) override {
@@ -37,10 +33,6 @@
base::Bind(&ChildThreadImplBrowserTest::SetUpOnChildThread, this));
}
- ChildGpuMemoryBufferManager* child_gpu_memory_buffer_manager() {
- return child_gpu_memory_buffer_manager_;
- }
-
ChildDiscardableSharedMemoryManager*
child_discardable_shared_memory_manager() {
return child_discardable_shared_memory_manager_;
@@ -48,13 +40,10 @@
private:
void SetUpOnChildThread() {
- child_gpu_memory_buffer_manager_ =
- ChildThreadImpl::current()->gpu_memory_buffer_manager();
child_discardable_shared_memory_manager_ =
ChildThreadImpl::current()->discardable_shared_memory_manager();
}
- ChildGpuMemoryBufferManager* child_gpu_memory_buffer_manager_;
ChildDiscardableSharedMemoryManager* child_discardable_shared_memory_manager_;
};
@@ -124,85 +113,4 @@
EXPECT_LT(base::TimeTicks::Now(), end);
}
-enum NativeBufferFlag { kDisableNativeBuffers, kEnableNativeBuffers };
-
-class ChildThreadImplGpuMemoryBufferBrowserTest
- : public ChildThreadImplBrowserTest,
- public testing::WithParamInterface<
- ::testing::tuple<NativeBufferFlag, gfx::GpuMemoryBuffer::Format>> {
- public:
- // Overridden from BrowserTestBase:
- void SetUpCommandLine(base::CommandLine* command_line) override {
- ChildThreadImplBrowserTest::SetUpCommandLine(command_line);
- NativeBufferFlag native_buffer_flag = ::testing::get<0>(GetParam());
- switch (native_buffer_flag) {
- case kEnableNativeBuffers:
- command_line->AppendSwitch(switches::kEnableNativeGpuMemoryBuffers);
- break;
- case kDisableNativeBuffers:
- break;
- }
- }
-};
-
-IN_PROC_BROWSER_TEST_P(ChildThreadImplGpuMemoryBufferBrowserTest, Map) {
- gfx::GpuMemoryBuffer::Format format = ::testing::get<1>(GetParam());
- gfx::Size buffer_size(4, 4);
-
- scoped_ptr<gfx::GpuMemoryBuffer> buffer =
- child_gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer(
- buffer_size, format, gfx::GpuMemoryBuffer::MAP);
- ASSERT_TRUE(buffer);
- EXPECT_EQ(format, buffer->GetFormat());
-
- size_t num_planes =
- GpuMemoryBufferImpl::NumberOfPlanesForGpuMemoryBufferFormat(format);
-
- // Map buffer planes.
- scoped_ptr<void* []> planes(new void* [num_planes]);
- bool rv = buffer->Map(planes.get());
- ASSERT_TRUE(rv);
- EXPECT_TRUE(buffer->IsMapped());
-
- // Get strides.
- scoped_ptr<int[]> strides(new int[num_planes]);
- buffer->GetStride(strides.get());
-
- // Write to buffer and check result.
- for (size_t plane = 0; plane < num_planes; ++plane) {
- size_t row_size_in_bytes = 0;
- EXPECT_TRUE(GpuMemoryBufferImpl::RowSizeInBytes(buffer_size.width(), format,
- plane, &row_size_in_bytes));
-
- scoped_ptr<char[]> data(new char[row_size_in_bytes]);
- memset(data.get(), 0x2a + plane, row_size_in_bytes);
- size_t height = buffer_size.height() /
- GpuMemoryBufferImpl::SubsamplingFactor(format, plane);
- for (size_t y = 0; y < height; ++y) {
- // Copy |data| to row |y| of |plane| and verify result.
- memcpy(static_cast<char*>(planes[plane]) + y * strides[plane], data.get(),
- row_size_in_bytes);
- EXPECT_EQ(memcmp(static_cast<char*>(planes[plane]) + y * strides[plane],
- data.get(), row_size_in_bytes),
- 0);
- }
- }
-
- buffer->Unmap();
- EXPECT_FALSE(buffer->IsMapped());
-}
-
-INSTANTIATE_TEST_CASE_P(
- ChildThreadImplGpuMemoryBufferBrowserTests,
- ChildThreadImplGpuMemoryBufferBrowserTest,
- ::testing::Combine(::testing::Values(kDisableNativeBuffers,
- kEnableNativeBuffers),
- // These formats are guaranteed to work on all platforms.
- ::testing::Values(gfx::GpuMemoryBuffer::R_8,
- gfx::GpuMemoryBuffer::RGBA_4444,
- gfx::GpuMemoryBuffer::RGBA_8888,
- gfx::GpuMemoryBuffer::BGRA_8888,
- gfx::GpuMemoryBuffer::YUV_420)));
-
-} // namespace
-} // namespace content
+} // content
« no previous file with comments | « content/browser/in_process_io_surface_manager_mac.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698