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

Unified Diff: sky/shell/org/domokit/sky/shell/TracingController.java

Issue 1139873004: Make android directory for Android-specific bits of SkyShell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « sky/shell/org/domokit/sky/shell/SkyMain.java ('k') | sky/shell/platform_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/org/domokit/sky/shell/TracingController.java
diff --git a/sky/shell/org/domokit/sky/shell/TracingController.java b/sky/shell/org/domokit/sky/shell/TracingController.java
deleted file mode 100644
index 716e0c007d833cdd46b65c79537436af446a9d53..0000000000000000000000000000000000000000
--- a/sky/shell/org/domokit/sky/shell/TracingController.java
+++ /dev/null
@@ -1,75 +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.
-
-package org.domokit.sky.shell;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Environment;
-import android.util.Log;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-import java.util.TimeZone;
-
-import org.chromium.base.JNINamespace;
-
-/**
- * A controller for the tracing system.
- */
-@JNINamespace("sky::shell")
-class TracingController {
- private static final String TAG = "TracingController";
- private static final String TRACING_START = ".TRACING_START";
- private static final String TRACING_STOP = ".TRACING_STOP";
-
- private final Context mContext;
- private final TracingBroadcastReceiver mBroadcastReceiver;
- private final TracingIntentFilter mIntentFilter;
-
- public TracingController(Context context) {
- mContext = context;
- mBroadcastReceiver = new TracingBroadcastReceiver();
- mIntentFilter = new TracingIntentFilter(context);
-
- mContext.registerReceiver(mBroadcastReceiver, mIntentFilter);
- }
-
- private String generateTracingFilePath() {
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HHmmss", Locale.US);
- formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
- File dir = mContext.getCacheDir();
- String date = formatter.format(new Date());
- File file = new File(dir, "sky-trace-" + date + ".json");
- return file.getPath();
- }
-
- class TracingIntentFilter extends IntentFilter {
- TracingIntentFilter(Context context) {
- Log.e(TAG, context.getPackageName() + TRACING_START);
- addAction(context.getPackageName() + TRACING_START);
- addAction(context.getPackageName() + TRACING_STOP);
- }
- }
-
- class TracingBroadcastReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent.getAction().endsWith(TRACING_START)) {
- nativeStartTracing();
- } else if (intent.getAction().endsWith(TRACING_STOP)) {
- nativeStopTracing(generateTracingFilePath());
- } else {
- Log.e(TAG, "Unexpected intent: " + intent);
- }
- }
- }
-
- private static native void nativeStartTracing();
- private static native void nativeStopTracing(String path);
-}
« no previous file with comments | « sky/shell/org/domokit/sky/shell/SkyMain.java ('k') | sky/shell/platform_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698