OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 20 matching lines...) Expand all Loading... |
31 import com.google.dart.tools.ui.internal.text.editor.AutoSaveHelper; | 31 import com.google.dart.tools.ui.internal.text.editor.AutoSaveHelper; |
32 | 32 |
33 import org.eclipse.core.runtime.IProgressMonitor; | 33 import org.eclipse.core.runtime.IProgressMonitor; |
34 import org.eclipse.core.runtime.IStatus; | 34 import org.eclipse.core.runtime.IStatus; |
35 import org.eclipse.core.runtime.Status; | 35 import org.eclipse.core.runtime.Status; |
36 import org.eclipse.core.runtime.jobs.Job; | 36 import org.eclipse.core.runtime.jobs.Job; |
37 import org.eclipse.swt.widgets.Display; | 37 import org.eclipse.swt.widgets.Display; |
38 import org.eclipse.ui.IStartup; | 38 import org.eclipse.ui.IStartup; |
39 import org.eclipse.ui.PlatformUI; | 39 import org.eclipse.ui.PlatformUI; |
40 | 40 |
| 41 import java.io.File; |
| 42 |
41 /** | 43 /** |
42 * This early startup class is called after the main workbench window opens, and
is used to warm up | 44 * This early startup class is called after the main workbench window opens, and
is used to warm up |
43 * various bits of compiler infrastructure. | 45 * various bits of compiler infrastructure. |
44 */ | 46 */ |
45 public class DartUIStartup implements IStartup { | 47 public class DartUIStartup implements IStartup { |
46 | 48 |
47 private class StartupJob extends Job { | 49 private class StartupJob extends Job { |
48 private CmdLineOptions options; | 50 private CmdLineOptions options; |
49 | 51 |
50 public StartupJob() { | 52 public StartupJob() { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 */ | 206 */ |
205 private void waitForAnalysis() { | 207 private void waitForAnalysis() { |
206 AnalysisServer server = PackageLibraryManagerProvider.getDefaultAnalysisSe
rver(); | 208 AnalysisServer server = PackageLibraryManagerProvider.getDefaultAnalysisSe
rver(); |
207 // Wait up to 2 minutes for the server to be idle | 209 // Wait up to 2 minutes for the server to be idle |
208 if (!server.waitForIdle(120000)) { | 210 if (!server.waitForIdle(120000)) { |
209 System.err.println("Stopped waiting for the analysis server."); | 211 System.err.println("Stopped waiting for the analysis server."); |
210 } | 212 } |
211 } | 213 } |
212 } | 214 } |
213 | 215 |
| 216 private static final String DART_INSTRUMENTATION_FLAGS_FILE_NAME = "dart_instr
umentation_flags.txt"; |
| 217 |
214 private static StartupJob startupJob; | 218 private static StartupJob startupJob; |
215 | 219 |
216 private static final Object startupSync = new Object(); | 220 private static final Object startupSync = new Object(); |
217 | 221 |
218 public static void cancelStartup() { | 222 public static void cancelStartup() { |
219 synchronized (startupSync) { | 223 synchronized (startupSync) { |
220 if (startupJob != null) { | 224 if (startupJob != null) { |
221 startupJob.cancel(); | 225 startupJob.cancel(); |
222 } | 226 } |
223 } | 227 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 259 |
256 } catch (Throwable throwable) { | 260 } catch (Throwable throwable) { |
257 // Catch any runtime exceptions that occur during warmup and log them. | 261 // Catch any runtime exceptions that occur during warmup and log them. |
258 DartToolsPlugin.log("Exception occured during editor warmup", throwable); | 262 DartToolsPlugin.log("Exception occured during editor warmup", throwable); |
259 | 263 |
260 } finally { | 264 } finally { |
261 instrumentation.log(); | 265 instrumentation.log(); |
262 } | 266 } |
263 } | 267 } |
264 | 268 |
| 269 /** |
| 270 * Determine if the {@value #DART_INSTRUMENTATION_FLAGS_FILE_NAME} file exists
in the user's dart |
| 271 * directory. |
| 272 * |
| 273 * @return {@code true} if the file exists, else false |
| 274 */ |
| 275 private boolean IsInstrumentationFlagFilePresent() { |
| 276 File dartDir = new File(DartCore.getUserDefaultDartFolder()); |
| 277 return new File(dartDir, DART_INSTRUMENTATION_FLAGS_FILE_NAME).exists(); |
| 278 } |
| 279 |
265 private void reportDartCoreDebug() { | 280 private void reportDartCoreDebug() { |
266 InstrumentationBuilder instrumentation = Instrumentation.builder("DartUIStar
tup.reportDartCoreDebug"); | 281 InstrumentationBuilder instrumentation = Instrumentation.builder("DartUIStar
tup.reportDartCoreDebug"); |
267 try { | 282 try { |
268 DartCoreDebug.record(instrumentation); | 283 DartCoreDebug.record(instrumentation); |
269 } finally { | 284 } finally { |
270 instrumentation.log(); | 285 instrumentation.log(); |
271 } | 286 } |
272 } | 287 } |
273 | 288 |
274 /** | 289 /** |
275 * Report core statistics about the executing platform to instrumentation syst
em | 290 * Report core statistics about the executing platform to instrumentation syst
em |
276 */ | 291 */ |
277 private void reportPlatformStatistics() { | 292 private void reportPlatformStatistics() { |
278 InstrumentationBuilder instrumentation = Instrumentation.builder("DartUIStar
tup.reportPlatformStatistics"); | 293 InstrumentationBuilder instrumentation = Instrumentation.builder("DartUIStar
tup.reportPlatformStatistics"); |
279 try { | 294 try { |
280 instrumentation.metric("BuildDate", DartCore.getBuildDate()); | 295 instrumentation.metric("BuildDate", DartCore.getBuildDate()); |
281 instrumentation.metric("BuildID", DartCore.getBuildId()); | 296 instrumentation.metric("BuildID", DartCore.getBuildId()); |
282 instrumentation.metric("Version", DartCore.getVersion()); | 297 instrumentation.metric("Version", DartCore.getVersion()); |
283 instrumentation.metric("SDKVersion", DartSdkManager.getManager().getSdk().
getSdkVersion()); | 298 instrumentation.metric("SDKVersion", DartSdkManager.getManager().getSdk().
getSdkVersion()); |
284 instrumentation.metric("OSVersion", FeedbackUtils.getOSName()); | 299 instrumentation.metric("OSVersion", FeedbackUtils.getOSName()); |
| 300 instrumentation.metric("IsInstrumentationFlagFilePresent", IsInstrumentati
onFlagFilePresent()); |
285 } finally { | 301 } finally { |
286 instrumentation.log(); | 302 instrumentation.log(); |
287 } | 303 } |
288 } | 304 } |
289 } | 305 } |
OLD | NEW |