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

Side by Side Diff: ui/ozone/public/ozone_platform.cc

Issue 2795503002: mash: Don't synthesize extra key press events in the window server (Closed)
Patch Set: remove InputMethodBridge workaround Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « ui/ozone/public/ozone_platform.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/ozone/public/ozone_platform.h"
6
6 #include "base/logging.h" 7 #include "base/logging.h"
7 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
8 #include "ui/events/devices/device_data_manager.h" 9 #include "ui/events/devices/device_data_manager.h"
9 #include "ui/ozone/platform_object.h" 10 #include "ui/ozone/platform_object.h"
10 #include "ui/ozone/platform_selection.h" 11 #include "ui/ozone/platform_selection.h"
11 #include "ui/ozone/public/ozone_platform.h"
12 #include "ui/ozone/public/ozone_switches.h"
13 12
14 namespace ui { 13 namespace ui {
15 14
16 namespace { 15 namespace {
17 16
18 bool g_platform_initialized_ui = false; 17 bool g_platform_initialized_ui = false;
19 bool g_platform_initialized_gpu = false; 18 bool g_platform_initialized_gpu = false;
20 19
21 } 20 } // namespace
22 21
23 OzonePlatform::OzonePlatform() { 22 OzonePlatform::OzonePlatform() {
24 DCHECK(!instance_) << "There should only be a single OzonePlatform."; 23 DCHECK(!instance_) << "There should only be a single OzonePlatform.";
25 instance_ = this; 24 instance_ = this;
26 g_platform_initialized_ui = false; 25 g_platform_initialized_ui = false;
27 g_platform_initialized_gpu = false; 26 g_platform_initialized_gpu = false;
28 } 27 }
29 28
30 OzonePlatform::~OzonePlatform() { 29 OzonePlatform::~OzonePlatform() {
31 DCHECK_EQ(instance_, this); 30 DCHECK_EQ(instance_, this);
(...skipping 21 matching lines...) Expand all
53 // static 52 // static
54 void OzonePlatform::InitializeForGPU(const InitParams& args) { 53 void OzonePlatform::InitializeForGPU(const InitParams& args) {
55 EnsureInstance(); 54 EnsureInstance();
56 if (g_platform_initialized_gpu) 55 if (g_platform_initialized_gpu)
57 return; 56 return;
58 g_platform_initialized_gpu = true; 57 g_platform_initialized_gpu = true;
59 instance_->InitializeGPU(args); 58 instance_->InitializeGPU(args);
60 } 59 }
61 60
62 // static 61 // static
62 void OzonePlatform::Shutdown() {
63 delete instance_;
64 // Destructor resets pointer.
65 }
66
67 // static
63 OzonePlatform* OzonePlatform::GetInstance() { 68 OzonePlatform* OzonePlatform::GetInstance() {
64 DCHECK(instance_) << "OzonePlatform is not initialized"; 69 DCHECK(instance_) << "OzonePlatform is not initialized";
65 return instance_; 70 return instance_;
66 } 71 }
67 72
68 // static 73 // static
69 OzonePlatform* OzonePlatform::EnsureInstance() { 74 OzonePlatform* OzonePlatform::EnsureInstance() {
70 if (!instance_) { 75 if (!instance_) {
71 TRACE_EVENT1("ozone", 76 TRACE_EVENT1("ozone",
72 "OzonePlatform::Initialize", 77 "OzonePlatform::Initialize",
73 "platform", 78 "platform",
74 GetOzonePlatformName()); 79 GetOzonePlatformName());
75 std::unique_ptr<OzonePlatform> platform = 80 std::unique_ptr<OzonePlatform> platform =
76 PlatformObject<OzonePlatform>::Create(); 81 PlatformObject<OzonePlatform>::Create();
77 82
78 // TODO(spang): Currently need to leak this object. 83 // TODO(spang): Currently need to leak this object.
79 OzonePlatform* pl = platform.release(); 84 OzonePlatform* pl = platform.release();
80 DCHECK_EQ(instance_, pl); 85 DCHECK_EQ(instance_, pl);
81 } 86 }
82 return instance_; 87 return instance_;
83 } 88 }
84 89
85 // static 90 // static
86 OzonePlatform* OzonePlatform::instance_; 91 OzonePlatform* OzonePlatform::instance_ = nullptr;
87 92
88 IPC::MessageFilter* OzonePlatform::GetGpuMessageFilter() { 93 IPC::MessageFilter* OzonePlatform::GetGpuMessageFilter() {
89 return nullptr; 94 return nullptr;
90 } 95 }
91 96
92 base::MessageLoop::Type OzonePlatform::GetMessageLoopTypeForGpu() { 97 base::MessageLoop::Type OzonePlatform::GetMessageLoopTypeForGpu() {
93 return base::MessageLoop::TYPE_DEFAULT; 98 return base::MessageLoop::TYPE_DEFAULT;
94 } 99 }
95 100
96 void OzonePlatform::AddInterfaces( 101 void OzonePlatform::AddInterfaces(
97 service_manager::InterfaceRegistry* registry) {} 102 service_manager::InterfaceRegistry* registry) {}
98 103
99 } // namespace ui 104 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/public/ozone_platform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698