Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package org.chromium.net; | 5 package org.chromium.net; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | |
| 7 import android.app.Activity; | 8 import android.app.Activity; |
| 8 import android.net.Uri; | 9 import android.net.Uri; |
| 9 import android.os.AsyncTask; | 10 import android.os.AsyncTask; |
| 10 import android.os.Bundle; | 11 import android.os.Bundle; |
| 11 import android.os.Debug; | 12 import android.os.Debug; |
| 12 | 13 |
| 13 import org.chromium.net.urlconnection.CronetHttpURLStreamHandler; | 14 import org.chromium.net.urlconnection.CronetHttpURLStreamHandler; |
| 14 import org.json.JSONException; | 15 import org.json.JSONException; |
| 15 import org.json.JSONObject; | 16 import org.json.JSONObject; |
| 16 | 17 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 private void reportResult() { | 205 private void reportResult() { |
| 205 if (mStartTimeMs == -1 || mStopTimeMs == -1) | 206 if (mStartTimeMs == -1 || mStopTimeMs == -1) |
| 206 throw new IllegalStateException("startTimer() or stopTimer() not called"); | 207 throw new IllegalStateException("startTimer() or stopTimer() not called"); |
| 207 try { | 208 try { |
| 208 mResults.put(mName, mStopTimeMs - mStartTimeMs); | 209 mResults.put(mName, mStopTimeMs - mStartTimeMs); |
| 209 } catch (JSONException e) { | 210 } catch (JSONException e) { |
| 210 System.out.println("Failed to write JSON result for " + mName); | 211 System.out.println("Failed to write JSON result for " + mName); |
| 211 } | 212 } |
| 212 } | 213 } |
| 213 | 214 |
| 215 @SuppressLint("NewApi") | |
|
newt (away)
2015/06/18 20:26:59
mention bug to fix this suppression
aurimas (slooooooooow)
2015/06/18 21:37:54
Done
| |
| 214 private void startLogging() { | 216 private void startLogging() { |
| 215 if (getConfigBoolean("CAPTURE_NETLOG")) { | 217 if (getConfigBoolean("CAPTURE_NETLOG")) { |
| 216 mCronetContext.startNetLogToFile(getFilesDir().getPath() + "/" + mName + ".json", | 218 mCronetContext.startNetLogToFile(getFilesDir().getPath() + "/" + mName + ".json", |
| 217 false); | 219 false); |
| 218 } | 220 } |
| 219 if (getConfigBoolean("CAPTURE_TRACE")) { | 221 if (getConfigBoolean("CAPTURE_TRACE")) { |
| 220 Debug.startMethodTracing(getFilesDir().getPath() + "/" + mName + ".trace"); | 222 Debug.startMethodTracing(getFilesDir().getPath() + "/" + mName + ".trace"); |
| 221 } else if (getConfigBoolean("CAPTURE_SAMPLED_TRACE")) { | 223 } else if (getConfigBoolean("CAPTURE_SAMPLED_TRACE")) { |
| 222 Debug.startMethodTracingSampling( | 224 Debug.startMethodTracingSampling( |
| 223 getFilesDir().getPath() + "/" + mName + ".trace", 800000 0, 10); | 225 getFilesDir().getPath() + "/" + mName + ".trace", 800000 0, 10); |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 } | 585 } |
| 584 | 586 |
| 585 @Override | 587 @Override |
| 586 public void onCreate(Bundle savedInstanceState) { | 588 public void onCreate(Bundle savedInstanceState) { |
| 587 super.onCreate(savedInstanceState); | 589 super.onCreate(savedInstanceState); |
| 588 mConfig = getIntent().getData(); | 590 mConfig = getIntent().getData(); |
| 589 // Execute benchmarks on another thread to avoid networking on main thre ad. | 591 // Execute benchmarks on another thread to avoid networking on main thre ad. |
| 590 new BenchmarkTask().execute(); | 592 new BenchmarkTask().execute(); |
| 591 } | 593 } |
| 592 } | 594 } |
| OLD | NEW |