summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorhenrika <henrika@chromium.org>2015-06-07 23:57:23 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-08 06:57:55 +0000
commit57d15367b02b9123792a5c2193185983476a3762 (patch)
tree935ba47451c70d69a69ffaf39bad1eb4c378f377 /mojo
parent15fb740a49ab3660b8f8d496cfab2e4d37c7e6ca (diff)
downloadchromium_src-57d15367b02b9123792a5c2193185983476a3762.zip
chromium_src-57d15367b02b9123792a5c2193185983476a3762.tar.gz
chromium_src-57d15367b02b9123792a5c2193185983476a3762.tar.bz2
Revert of Mandoline: Remove native_viewport.mojom (patchset #14 id:250001 of https://codereview.chromium.org/1149083010/)
Reason for revert: This patch seems to break GN bots on Windows. See e.g. http://build.chromium.org/p/chromium.win/builders/Win8%20GN/builds/8167 Original issue's description: > Mandoline: Remove native_viewport.mojom > > native_viewport mojom + app add a lot of unnecessary complexity. For now, this should be a part of the view_manager. A future patch will get rid of native_viewport completely and will teach display_manager to dispense platform_windows. > > BUG=487881 > Test=internal change only. > > Committed: https://crrev.com/3a4eab3f2f4fd8f7c7eb4d195c0e86a47e085d98 > Cr-Commit-Position: refs/heads/master@{#333183} TBR=sky@chromium.org,fsamuel@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=487881 Review URL: https://codereview.chromium.org/1164553004 Cr-Commit-Position: refs/heads/master@{#333245}
Diffstat (limited to 'mojo')
-rw-r--r--mojo/runner/android/native_viewport_application_loader.cc55
-rw-r--r--mojo/runner/android/native_viewport_application_loader.h58
2 files changed, 113 insertions, 0 deletions
diff --git a/mojo/runner/android/native_viewport_application_loader.cc b/mojo/runner/android/native_viewport_application_loader.cc
new file mode 100644
index 0000000..55979c7
--- /dev/null
+++ b/mojo/runner/android/native_viewport_application_loader.cc
@@ -0,0 +1,55 @@
+// Copyright 2014 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 "mojo/runner/android/native_viewport_application_loader.h"
+
+#include "components/view_manager/gles2/gpu_state.h"
+#include "components/view_manager/native_viewport/native_viewport_impl.h"
+#include "mojo/application/public/cpp/application_impl.h"
+
+namespace mojo {
+namespace runner {
+
+NativeViewportApplicationLoader::NativeViewportApplicationLoader() {
+}
+
+NativeViewportApplicationLoader::~NativeViewportApplicationLoader() {
+}
+
+void NativeViewportApplicationLoader::Load(
+ const GURL& url,
+ InterfaceRequest<Application> application_request) {
+ DCHECK(application_request.is_pending());
+ app_.reset(new ApplicationImpl(this, application_request.Pass()));
+}
+
+bool NativeViewportApplicationLoader::ConfigureIncomingConnection(
+ ApplicationConnection* connection) {
+ connection->AddService<NativeViewport>(this);
+ connection->AddService<Gpu>(this);
+ return true;
+}
+
+void NativeViewportApplicationLoader::Create(
+ ApplicationConnection* connection,
+ InterfaceRequest<NativeViewport> request) {
+ if (!gpu_state_)
+ gpu_state_ = new gles2::GpuState;
+ // Pass a null AppRefCount because on Android the NativeViewPort app must
+ // live on the main thread and we don't want to exit that when all the native
+ // viewports are gone.
+ new native_viewport::NativeViewportImpl(
+ false, gpu_state_, request.Pass(),
+ make_scoped_ptr<mojo::AppRefCount>(nullptr));
+}
+
+void NativeViewportApplicationLoader::Create(ApplicationConnection* connection,
+ InterfaceRequest<Gpu> request) {
+ if (!gpu_state_)
+ gpu_state_ = new gles2::GpuState;
+ new gles2::GpuImpl(request.Pass(), gpu_state_);
+}
+
+} // namespace runner
+} // namespace mojo
diff --git a/mojo/runner/android/native_viewport_application_loader.h b/mojo/runner/android/native_viewport_application_loader.h
new file mode 100644
index 0000000..25b02fd
--- /dev/null
+++ b/mojo/runner/android/native_viewport_application_loader.h
@@ -0,0 +1,58 @@
+// Copyright 2014 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 MOJO_RUNNER_ANDROID_NATIVE_VIEWPORT_APPLICATION_LOADER_H_
+#define MOJO_RUNNER_ANDROID_NATIVE_VIEWPORT_APPLICATION_LOADER_H_
+
+#include "components/view_manager/gles2/gpu_impl.h"
+#include "components/view_manager/public/interfaces/gpu.mojom.h"
+#include "components/view_manager/public/interfaces/native_viewport.mojom.h"
+#include "mojo/application/public/cpp/application_delegate.h"
+#include "mojo/application/public/cpp/interface_factory.h"
+#include "mojo/shell/application_loader.h"
+
+namespace gles2 {
+class GpuState;
+}
+
+namespace mojo {
+
+class ApplicationImpl;
+
+namespace runner {
+
+class NativeViewportApplicationLoader : public shell::ApplicationLoader,
+ public ApplicationDelegate,
+ public InterfaceFactory<NativeViewport>,
+ public InterfaceFactory<Gpu> {
+ public:
+ NativeViewportApplicationLoader();
+ ~NativeViewportApplicationLoader();
+
+ private:
+ // ApplicationLoader implementation.
+ void Load(const GURL& url,
+ InterfaceRequest<Application> application_request) override;
+
+ // ApplicationDelegate implementation.
+ bool ConfigureIncomingConnection(ApplicationConnection* connection) override;
+
+ // InterfaceFactory<NativeViewport> implementation.
+ void Create(ApplicationConnection* connection,
+ InterfaceRequest<NativeViewport> request) override;
+
+ // InterfaceFactory<Gpu> implementation.
+ void Create(ApplicationConnection* connection,
+ InterfaceRequest<Gpu> request) override;
+
+ scoped_refptr<gles2::GpuState> gpu_state_;
+ scoped_ptr<ApplicationImpl> app_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader);
+};
+
+} // namespace runner
+} // namespace mojo
+
+#endif // MOJO_RUNNER_ANDROID_NATIVE_VIEWPORT_APPLICATION_LOADER_H_