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

Unified Diff: ui/ozone/ozone_platform.cc

Issue 143083003: ozone: Add some tracing for platform & evdev (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add platform name to event Created 6 years, 11 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 | « ui/events/ozone/event_converter_ozone.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/ozone_platform.cc
diff --git a/ui/ozone/ozone_platform.cc b/ui/ozone/ozone_platform.cc
index b87dc8ffcae2c8d5476a5ea638d23669a7c444f8..63b5e84fd38e3df3808dfcc05785cf8c05e4bcbb 100644
--- a/ui/ozone/ozone_platform.cc
+++ b/ui/ozone/ozone_platform.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "ui/ozone/ozone_platform.h"
#include "ui/ozone/ozone_platform_list.h"
@@ -14,11 +15,7 @@ namespace {
// Helper to construct an OzonePlatform by name using the platform list.
OzonePlatform* CreatePlatform(const std::string& platform_name) {
- // The first platform is the defualt.
- if (platform_name == "default" && kOzonePlatformCount > 0)
- return kOzonePlatforms[0].constructor();
-
- // Otherwise, search for a matching platform in the list.
+ // Search for a matching platform in the list.
for (int i = 0; i < kOzonePlatformCount; ++i)
if (platform_name == kOzonePlatforms[i].name)
return kOzonePlatforms[i].constructor();
@@ -28,9 +25,11 @@ OzonePlatform* CreatePlatform(const std::string& platform_name) {
}
// Returns the name of the platform to use (value of --ozone-platform flag).
-std::string GetRequestedPlatform() {
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kOzonePlatform))
- return "default";
+std::string GetPlatformName() {
+ // The first platform is the default.
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kOzonePlatform) &&
+ kOzonePlatformCount > 0)
+ return kOzonePlatforms[0].name;
return CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kOzonePlatform);
}
@@ -49,7 +48,11 @@ void OzonePlatform::Initialize() {
if (instance_)
return;
- instance_ = CreatePlatform(GetRequestedPlatform());
+ std::string platform = GetPlatformName();
+
+ TRACE_EVENT1("ozone", "OzonePlatform::Initialize", "platform", platform);
+
+ instance_ = CreatePlatform(platform);
// Inject ozone interfaces.
gfx::SurfaceFactoryOzone::SetInstance(instance_->GetSurfaceFactoryOzone());
« no previous file with comments | « ui/events/ozone/event_converter_ozone.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698