diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h index 2d78c9bdf8593e..3fda3ac60a1c46 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h @@ -42,7 +42,6 @@ class GpuChannelHost; class NestedMessagePumpAndroid; class ScopedAllowWaitForAndroidLayoutTests; class ScopedAllowWaitForDebugURL; -class SoftwareOutputDeviceMus; class TextInputClientMac; } // namespace content namespace dbus { @@ -218,10 +217,7 @@ class BASE_EXPORT ThreadRestrictions { friend class net::NetworkChangeNotifierMac; // http://crbug.com/125097 friend class ::BrowserProcessImpl; // http://crbug.com/125207 friend class ::NativeBackendKWallet; // http://crbug.com/125331 -#if !defined(OFFICIAL_BUILD) - friend class content::SoftwareOutputDeviceMus; // Interim non-production code -#endif -// END USAGE THAT NEEDS TO BE FIXED. + // END USAGE THAT NEEDS TO BE FIXED. #if ENABLE_THREAD_RESTRICTIONS static bool SetWaitAllowed(bool allowed); diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index f89f2b2acddb72..e2ee391398b98d 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -154,10 +154,6 @@ source_set("ui") { } } - if (use_aura) { - defines += [ "MOJO_RUNNER_CLIENT" ] - } - if (enable_basic_printing || enable_print_preview) { deps += [ "//printing" ] } diff --git a/components/bitmap_uploader/bitmap_uploader.cc b/components/bitmap_uploader/bitmap_uploader.cc index bfa8cd95204e47..f6525dafa84156 100644 --- a/components/bitmap_uploader/bitmap_uploader.cc +++ b/components/bitmap_uploader/bitmap_uploader.cc @@ -29,9 +29,6 @@ void OnGotContentHandlerID(uint32_t content_handler_id) {} } // namespace -const char kBitmapUploaderForAcceleratedWidget[] = - "__BITMAP_UPLOADER_ACCELERATED_WIDGET__"; - BitmapUploader::BitmapUploader(mus::Window* window) : window_(window), color_(g_transparent_color), diff --git a/components/bitmap_uploader/bitmap_uploader.h b/components/bitmap_uploader/bitmap_uploader.h index 8ced8938d339d5..ccb4d7a7b54674 100644 --- a/components/bitmap_uploader/bitmap_uploader.h +++ b/components/bitmap_uploader/bitmap_uploader.h @@ -20,8 +20,6 @@ class Shell; namespace bitmap_uploader { -extern const char kBitmapUploaderForAcceleratedWidget[]; - // BitmapUploader is useful if you want to draw a bitmap or color in a // mus::Window. class BitmapUploader : public mus::mojom::SurfaceClient { diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 68dc8d1595c96c..66a7ab957a2f41 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -427,13 +427,7 @@ source_set("browser") { "//ui/strings", "//ui/views/mus:for_component", "//ui/wm", - "//components/bitmap_uploader", ] - sources += [ - "compositor/software_output_device_mus.cc", - "compositor/software_output_device_mus.h", - ] - defines += [ "MOJO_RUNNER_CLIENT" ] } else { # Not aura. sources -= [ "media/capture/cursor_renderer_aura.cc", diff --git a/content/browser/compositor/DEPS b/content/browser/compositor/DEPS index 70240ed5c1dbd0..1701f72a861e65 100644 --- a/content/browser/compositor/DEPS +++ b/content/browser/compositor/DEPS @@ -1,4 +1,3 @@ include_rules = [ - "+components/bitmap_uploader", - "+ui/platform_window", + "+ui/platform_window", ] diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index 2b9cd69683d4ed..7e2c513b98ee93 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc @@ -28,7 +28,6 @@ #include "content/browser/compositor/offscreen_browser_compositor_output_surface.h" #include "content/browser/compositor/reflector_impl.h" #include "content/browser/compositor/software_browser_compositor_output_surface.h" -#include "content/browser/compositor/software_output_device_mus.h" #include "content/browser/gpu/browser_gpu_channel_host_factory.h" #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" #include "content/browser/gpu/compositor_util.h" @@ -149,14 +148,6 @@ GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() { scoped_ptr GpuProcessTransportFactory::CreateSoftwareOutputDevice( ui::Compositor* compositor) { -#if defined(MOJO_RUNNER_CLIENT) - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - "mojo-platform-channel-handle")) { - return scoped_ptr( - new SoftwareOutputDeviceMus(compositor)); - } -#endif - #if defined(OS_WIN) return scoped_ptr( new SoftwareOutputDeviceWin(software_backing_.get(), compositor)); @@ -201,16 +192,6 @@ CreateOverlayCandidateValidator(gfx::AcceleratedWidget widget) { } static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { -#if defined(MOJO_RUNNER_CLIENT) - // Chrome running as a mojo app currently can only use software compositing. - // TODO(rjkroege): http://crbug.com/548451 - // TODO(rjkroege): Make IsRunningInMojoRunner callable from content. - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - "mojo-platform-channel-handle")) { - return false; - } -#endif - #if defined(OS_CHROMEOS) // Software fallback does not happen on Chrome OS. return true; diff --git a/content/browser/compositor/software_output_device_mus.cc b/content/browser/compositor/software_output_device_mus.cc deleted file mode 100644 index c16f5967ebff2c..00000000000000 --- a/content/browser/compositor/software_output_device_mus.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/compositor/software_output_device_mus.h" - -#include "base/threading/thread_restrictions.h" -#include "components/bitmap_uploader/bitmap_uploader.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "third_party/skia/include/core/SkDevice.h" -#include "ui/base/view_prop.h" -#include "ui/compositor/compositor.h" -#include "ui/gfx/skia_util.h" - -namespace content { - -SoftwareOutputDeviceMus::SoftwareOutputDeviceMus(ui::Compositor* compositor) - : compositor_(compositor) {} - -void SoftwareOutputDeviceMus::EndPaint() { - SoftwareOutputDevice::EndPaint(); - base::ThreadRestrictions::ScopedAllowWait wait; - - if (!surface_) - return; - - gfx::Rect rect = damage_rect_; - rect.Intersect(gfx::Rect(viewport_pixel_size_)); - if (rect.IsEmpty()) - return; - - gfx::AcceleratedWidget widget = compositor_->widget(); - bitmap_uploader::BitmapUploader* uploader = - reinterpret_cast(ui::ViewProp::GetValue( - widget, bitmap_uploader::kBitmapUploaderForAcceleratedWidget)); - DCHECK(uploader); - - SkImageInfo info; - size_t rowBytes; - const void* addr = surface_->peekPixels(&info, &rowBytes); - - if (!addr) { - LOG(WARNING) << "SoftwareOutputDeviceMus: skia surface did not provide us " - "with pixels"; - return; - } - - const unsigned char* pixels = static_cast(addr); - - // TODO(rjkroege): This makes an additional copy. Improve the - // bitmap_uploader API to remove. - scoped_ptr> data(new std::vector( - pixels, pixels + rowBytes * viewport_pixel_size_.height())); - uploader->SetBitmap(viewport_pixel_size_.width(), - viewport_pixel_size_.height(), data.Pass(), - bitmap_uploader::BitmapUploader::BGRA); -} - -} // namespace content diff --git a/content/browser/compositor/software_output_device_mus.h b/content/browser/compositor/software_output_device_mus.h deleted file mode 100644 index d4a2e4500b4675..00000000000000 --- a/content/browser/compositor/software_output_device_mus.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_MUS_H_ -#define CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_MUS_H_ - -#include "base/macros.h" -#include "cc/output/software_output_device.h" -#include "content/common/content_export.h" - -namespace ui { -class Compositor; -} - -namespace content { - -// Mus implementation of software compositing: Chrome will do a software -// composite and ship the resultant bitmap to an instance of the mus -// window server. Remove this upon completion of http://crbug.com/548451 -class SoftwareOutputDeviceMus : public cc::SoftwareOutputDevice { - public: - explicit SoftwareOutputDeviceMus(ui::Compositor* compositor); - - private: - // cc::SoftwareOutputDevice - void EndPaint() override; - - ui::Compositor* compositor_; - - DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceMus); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_MUS_H_ diff --git a/ui/views/mus/BUILD.gn b/ui/views/mus/BUILD.gn index 5ab84dc6720f61..dd80c4aa5de23b 100644 --- a/ui/views/mus/BUILD.gn +++ b/ui/views/mus/BUILD.gn @@ -42,7 +42,6 @@ component("mus") { "//base/third_party/dynamic_annotations", "//cc", "//cc/surfaces", - "//components/bitmap_uploader", "//components/mus/gles2:lib", "//components/mus/public/cpp", "//components/mus/public/interfaces", diff --git a/ui/views/mus/DEPS b/ui/views/mus/DEPS index 447d4b431639bb..6ddcc64508ef3c 100644 --- a/ui/views/mus/DEPS +++ b/ui/views/mus/DEPS @@ -2,7 +2,6 @@ include_rules = [ "+cc", "-cc/blink", "+components/font_service/public", - "+components/bitmap_uploader", "+components/gpu", "+components/mus", "+components/resource_provider", diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc index 70245bcc03a679..578c9ea19810f9 100644 --- a/ui/views/mus/native_widget_mus.cc +++ b/ui/views/mus/native_widget_mus.cc @@ -259,15 +259,13 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) { // picked up. ui::ContextFactory* default_context_factory = aura::Env::GetInstance()->context_factory(); - // For Chrome, we need the GpuProcessTransportFactory so that renderer and - // browser pixels are composited into a single backing - // SoftwareOutputDeviceMus. - if (!default_context_factory) - aura::Env::GetInstance()->set_context_factory(context_factory_.get()); + aura::Env::GetInstance()->set_context_factory(context_factory_.get()); window_tree_host_.reset( new WindowTreeHostMus(shell_, this, window_, surface_type_)); window_tree_host_->InitHost(); aura::Env::GetInstance()->set_context_factory(default_context_factory); + DCHECK_EQ(context_factory_.get(), + window_tree_host_->compositor()->context_factory()); focus_client_.reset(new wm::FocusController(new FocusRulesImpl)); diff --git a/ui/views/mus/platform_window_mus.cc b/ui/views/mus/platform_window_mus.cc index 3a9c85f5623d46..be343eb045b9a1 100644 --- a/ui/views/mus/platform_window_mus.cc +++ b/ui/views/mus/platform_window_mus.cc @@ -13,11 +13,6 @@ namespace views { -namespace { -static uint32_t accelerated_widget_count = 1; - -} // namespace - PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate, mus::Window* mus_window) : delegate_(delegate), @@ -28,18 +23,9 @@ PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate, DCHECK(mus_window_); mus_window_->AddObserver(this); - // We need accelerated widget numbers to be different for each - // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t - // has this property. -#if defined(OS_WIN) - delegate_->OnAcceleratedWidgetAvailable( - reinterpret_cast(accelerated_widget_count++), - mus_window_->viewport_metrics().device_pixel_ratio); -#else delegate_->OnAcceleratedWidgetAvailable( - static_cast(accelerated_widget_count++), + gfx::kNullAcceleratedWidget, mus_window_->viewport_metrics().device_pixel_ratio); -#endif } PlatformWindowMus::~PlatformWindowMus() { diff --git a/ui/views/mus/window_tree_host_mus.cc b/ui/views/mus/window_tree_host_mus.cc index 5f0b82564d30f0..7e01767aac928c 100644 --- a/ui/views/mus/window_tree_host_mus.cc +++ b/ui/views/mus/window_tree_host_mus.cc @@ -4,11 +4,9 @@ #include "ui/views/mus/window_tree_host_mus.h" -#include "components/bitmap_uploader/bitmap_uploader.h" #include "mojo/application/public/interfaces/shell.mojom.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" -#include "ui/base/view_prop.h" #include "ui/events/event.h" #include "ui/views/mus/input_method_mus.h" #include "ui/views/mus/native_widget_mus.h" @@ -33,13 +31,6 @@ WindowTreeHostMus::WindowTreeHostMus(mojo::Shell* shell, dispatcher()->set_transform_events(false); compositor()->SetHostHasTransparentBackground(true); - bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(window)); - bitmap_uploader_->Init(shell); - prop_.reset( - new ui::ViewProp(GetAcceleratedWidget(), - bitmap_uploader::kBitmapUploaderForAcceleratedWidget, - bitmap_uploader_.get())); - input_method_.reset(new InputMethodMUS(this, window)); SetSharedInputMethod(input_method_.get()); } diff --git a/ui/views/mus/window_tree_host_mus.h b/ui/views/mus/window_tree_host_mus.h index 1a4473ee7a6c84..5882a28d626287 100644 --- a/ui/views/mus/window_tree_host_mus.h +++ b/ui/views/mus/window_tree_host_mus.h @@ -12,10 +12,6 @@ class SkBitmap; -namespace bitmap_uploader { -class BitmapUploader; -} - namespace mojo { class Shell; } @@ -26,7 +22,6 @@ class Window; namespace ui { class Compositor; -class ViewProp; } namespace views { @@ -44,9 +39,6 @@ class VIEWS_MUS_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform { ~WindowTreeHostMus() override; PlatformWindowMus* platform_window(); - bitmap_uploader::BitmapUploader* bitmap_uploader() { - return bitmap_uploader_.get(); - }; ui::PlatformWindowState show_state() const { return show_state_; } private: @@ -59,8 +51,6 @@ class VIEWS_MUS_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform { NativeWidgetMus* native_widget_; scoped_ptr input_method_; ui::PlatformWindowState show_state_; - scoped_ptr bitmap_uploader_; - scoped_ptr prop_; DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus); };