NoTransportImageTransportFactory is compiled into only test targets.

NoTransportImageTransportFactory is used for only unittests, so compile it only
for unittests.

BUG=N/A

Review URL: https://codereview.chromium.org/369923003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281802 0039d316-1c4b-4281-b951-d872f2087c98
parent 5f072433
......@@ -6,7 +6,6 @@
#include "base/command_line.h"
#include "content/browser/compositor/gpu_process_transport_factory.h"
#include "content/browser/compositor/no_transport_image_transport_factory.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/compositor_switches.h"
#include "ui/gl/gl_implementation.h"
......@@ -33,7 +32,7 @@ void ImageTransportFactory::Initialize() {
}
void ImageTransportFactory::InitializeForUnitTests(
scoped_ptr<ui::ContextFactory> test_factory) {
scoped_ptr<ImageTransportFactory> factory) {
DCHECK(!g_factory);
DCHECK(!g_initialized_for_unit_tests);
g_initialized_for_unit_tests = true;
......@@ -42,7 +41,7 @@ void ImageTransportFactory::InitializeForUnitTests(
if (command_line->HasSwitch(switches::kEnablePixelOutputInTests))
g_disable_null_draw = new gfx::DisableNullDrawGLBindings;
SetFactory(new NoTransportImageTransportFactory(test_factory.Pass()));
SetFactory(factory.release());
}
// static
......
......@@ -55,8 +55,7 @@ class CONTENT_EXPORT ImageTransportFactory {
// Initializes the global transport factory for unit tests using the provided
// context factory.
static void InitializeForUnitTests(
scoped_ptr<ui::ContextFactory> test_factory);
static void InitializeForUnitTests(scoped_ptr<ImageTransportFactory> factory);
// Terminates the global transport factory.
static void Terminate();
......
......@@ -2,24 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/compositor/no_transport_image_transport_factory.h"
#include "content/browser/compositor/test/no_transport_image_transport_factory.h"
#include "cc/output/context_provider.h"
#include "content/common/gpu/client/gl_helper.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/test/in_process_context_factory.h"
namespace content {
NoTransportImageTransportFactory::NoTransportImageTransportFactory(
scoped_ptr<ui::ContextFactory> context_factory)
: context_factory_(context_factory.Pass()) {}
NoTransportImageTransportFactory::NoTransportImageTransportFactory()
: context_factory_(new ui::InProcessContextFactory) {
}
NoTransportImageTransportFactory::~NoTransportImageTransportFactory() {
scoped_ptr<GLHelper> lost_gl_helper = gl_helper_.Pass();
FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
observer_list_,
OnLostResources());
FOR_EACH_OBSERVER(
ImageTransportFactoryObserver, observer_list_, OnLostResources());
}
ui::ContextFactory* NoTransportImageTransportFactory::GetContextFactory() {
......
......@@ -18,8 +18,7 @@ namespace content {
// An ImageTransportFactory that disables transport.
class NoTransportImageTransportFactory : public ImageTransportFactory {
public:
explicit NoTransportImageTransportFactory(
scoped_ptr<ui::ContextFactory> context_factory);
NoTransportImageTransportFactory();
virtual ~NoTransportImageTransportFactory();
// ImageTransportFactory implementation.
......
......@@ -30,8 +30,7 @@
#endif
#if defined(USE_AURA) || (defined(OS_MACOSX) && !defined(OS_IOS))
#include "content/browser/compositor/image_transport_factory.h"
#include "ui/compositor/test/in_process_context_factory.h"
#include "content/browser/compositor/test/no_transport_image_transport_factory.h"
#endif
#if defined(USE_AURA)
......@@ -457,7 +456,8 @@ class RenderWidgetHostTest : public testing::Test {
#if defined(USE_AURA) || (defined(OS_MACOSX) && !defined(OS_IOS))
if (IsDelegatedRendererEnabled()) {
ImageTransportFactory::InitializeForUnitTests(
scoped_ptr<ui::ContextFactory>(new ui::InProcessContextFactory));
scoped_ptr<ImageTransportFactory>(
new NoTransportImageTransportFactory));
}
#endif
#if defined(USE_AURA)
......
......@@ -15,6 +15,7 @@
#include "cc/output/copy_output_request.h"
#include "content/browser/browser_thread_impl.h"
#include "content/browser/compositor/resize_lock.h"
#include "content/browser/compositor/test/no_transport_image_transport_factory.h"
#include "content/browser/renderer_host/overscroll_controller.h"
#include "content/browser/renderer_host/overscroll_controller_delegate.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
......@@ -48,7 +49,6 @@
#include "ui/base/ui_base_types.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/test/draw_waiter_for_test.h"
#include "ui/compositor/test/in_process_context_factory.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/gestures/gesture_configuration.h"
......@@ -312,11 +312,12 @@ class RenderWidgetHostViewAuraTest : public testing::Test {
: browser_thread_for_ui_(BrowserThread::UI, &message_loop_) {}
void SetUpEnvironment() {
ui::ContextFactory* context_factory = new ui::InProcessContextFactory;
ImageTransportFactory::InitializeForUnitTests(
scoped_ptr<ui::ContextFactory>(context_factory));
scoped_ptr<ImageTransportFactory>(
new NoTransportImageTransportFactory));
aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
aura_test_helper_->SetUp(context_factory);
aura_test_helper_->SetUp(
ImageTransportFactory::GetInstance()->GetContextFactory());
new wm::DefaultActivationClient(aura_test_helper_->root_window());
browser_context_.reset(new TestBrowserContext);
......
......@@ -8,7 +8,7 @@
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/message_loop/message_loop.h"
#include "content/browser/compositor/image_transport_factory.h"
#include "content/browser/compositor/test/no_transport_image_transport_factory.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
......@@ -19,7 +19,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#include "ui/base/layout.h"
#include "ui/compositor/test/in_process_context_factory.h"
using content::RenderWidgetHostViewMac;
......@@ -101,7 +100,8 @@ class RenderWidgetHostViewMacEditCommandHelperTest : public PlatformTest {
virtual void SetUp() {
if (IsDelegatedRendererEnabled()) {
ImageTransportFactory::InitializeForUnitTests(
scoped_ptr<ui::ContextFactory>(new ui::InProcessContextFactory));
scoped_ptr<ImageTransportFactory>(
new NoTransportImageTransportFactory));
}
}
virtual void TearDown() {
......
......@@ -9,7 +9,7 @@
#include "base/mac/sdk_forward_declarations.h"
#include "base/strings/utf_string_conversions.h"
#include "content/browser/browser_thread_impl.h"
#include "content/browser/compositor/image_transport_factory.h"
#include "content/browser/compositor/test/no_transport_image_transport_factory.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/common/gpu/gpu_messages.h"
......@@ -23,7 +23,6 @@
#include "content/test/test_render_view_host.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/compositor/test/in_process_context_factory.h"
#include "ui/events/test/cocoa_test_event_utils.h"
#import "ui/gfx/test/ui_cocoa_test_helper.h"
......@@ -170,7 +169,8 @@ class RenderWidgetHostViewMacTest : public RenderViewHostImplTestHarness {
RenderViewHostImplTestHarness::SetUp();
if (IsDelegatedRendererEnabled()) {
ImageTransportFactory::InitializeForUnitTests(
scoped_ptr<ui::ContextFactory>(new ui::InProcessContextFactory));
scoped_ptr<ImageTransportFactory>(
new NoTransportImageTransportFactory));
}
// TestRenderViewHost's destruction assumes that its view is a
......
......@@ -1398,8 +1398,6 @@
'browser/compositor/gpu_process_transport_factory.h',
'browser/compositor/image_transport_factory.cc',
'browser/compositor/image_transport_factory.h',
'browser/compositor/no_transport_image_transport_factory.cc',
'browser/compositor/no_transport_image_transport_factory.h',
'browser/compositor/onscreen_display_client.cc',
'browser/compositor/onscreen_display_client.h',
'browser/compositor/overlay_candidate_validator_ozone.cc',
......@@ -1599,7 +1597,13 @@
['OS!="android" and OS!="ios"', {
'dependencies': [
'browser/tracing/tracing_resources.gyp:tracing_resources',
'../ui/compositor/compositor.gyp:compositor',
],
'sources': [ '<@(compositor_browser_sources)' ],
}, {
'sources/': [
['exclude', '^public/browser/context_factory.h'],
]
}],
['OS!="ios"', {
'dependencies': [
......@@ -1787,16 +1791,6 @@
['exclude', '^browser/renderer_host/ui_events_helper.h'],
],
}],
['use_aura==1 or OS=="mac"', {
'dependencies': [
'../ui/compositor/compositor.gyp:compositor',
],
'sources': [ '<@(compositor_browser_sources)' ],
}, {
'sources/': [
['exclude', '^public/browser/context_factory.h'],
]
}],
['enable_plugins==1', {
'dependencies': [
'../ppapi/ppapi_internal.gyp:ppapi_ipc',
......
......@@ -325,18 +325,18 @@
'../ui/wm/wm.gyp:wm',
],
}],
['use_aura==1 or OS=="mac"', {
'dependencies': [
'../ui/compositor/compositor.gyp:compositor',
],
}],
['OS=="win"', {
'dependencies': [
'../third_party/iaccessible2/iaccessible2.gyp:iaccessible2',
],
}],
['OS!="android" and OS!="ios"', {
'sources': [
'browser/compositor/test/no_transport_image_transport_factory.cc',
'browser/compositor/test/no_transport_image_transport_factory.h',
],
'dependencies': [
'../ui/compositor/compositor.gyp:compositor',
'../third_party/libvpx/libvpx.gyp:libvpx',
],
}],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment