| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Dart project authors. | 2 * Copyright 2012 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 |
| 11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
| 12 * the License. | 12 * the License. |
| 13 */ | 13 */ |
| 14 package com.google.dart.tools.core.analysis.timing; | 14 package com.google.dart.tools.core.analysis.timing; |
| 15 | 15 |
| 16 import com.google.dart.engine.ast.CompilationUnit; | 16 import com.google.dart.engine.ast.CompilationUnit; |
| 17 import com.google.dart.engine.context.AnalysisContext; | 17 import com.google.dart.engine.context.AnalysisContext; |
| 18 import com.google.dart.engine.context.AnalysisException; | 18 import com.google.dart.engine.context.AnalysisException; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 @Override | 87 @Override |
| 88 public CompilationUnit parseCompilationUnit(Source source) throws AnalysisEx
ception { | 88 public CompilationUnit parseCompilationUnit(Source source) throws AnalysisEx
ception { |
| 89 return compilationUnit; | 89 return compilationUnit; |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 private final class MockIndexForScan implements Index { | 93 private final class MockIndexForScan implements Index { |
| 94 @Override | 94 @Override |
| 95 public void getRelationships(Element element, Relationship relationship, | 95 public void getRelationships( |
| 96 RelationshipCallback callback) { | 96 Element element, Relationship relationship, RelationshipCallback callbac
k) { |
| 97 // ignored | 97 // ignored |
| 98 } | 98 } |
| 99 | 99 |
| 100 @Override | 100 @Override |
| 101 public String getStatistics() { | 101 public String getStatistics() { |
| 102 // ignored | 102 // ignored |
| 103 return null; | 103 return null; |
| 104 } | 104 } |
| 105 | 105 |
| 106 @Override | 106 @Override |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 public void removeWorker(AnalysisWorker analysisWorker) { | 311 public void removeWorker(AnalysisWorker analysisWorker) { |
| 312 throw new UnsupportedOperationException(); | 312 throw new UnsupportedOperationException(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 @Override | 315 @Override |
| 316 public IFile resolvePackageUri(IResource relativeTo, String uri) { | 316 public IFile resolvePackageUri(IResource relativeTo, String uri) { |
| 317 throw new UnsupportedOperationException(); | 317 throw new UnsupportedOperationException(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 @Override | 320 @Override |
| 321 public String resolvePathToPackage(IResource resource, String filePath) { |
| 322 throw new UnsupportedOperationException(); |
| 323 } |
| 324 |
| 325 @Override |
| 321 public IFileInfo resolveUriToFileInfo(IResource relativeTo, String uri) { | 326 public IFileInfo resolveUriToFileInfo(IResource relativeTo, String uri) { |
| 322 return null; | 327 return null; |
| 323 } | 328 } |
| 324 | 329 |
| 325 @Override | 330 @Override |
| 326 public void setDart2JSHintOption(boolean enableDart2JSHints) { | 331 public void setDart2JSHintOption(boolean enableDart2JSHints) { |
| 327 throw new UnsupportedOperationException(); | 332 throw new UnsupportedOperationException(); |
| 328 } | 333 } |
| 329 | 334 |
| 330 @Override | 335 @Override |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 contextCount = 0; | 473 contextCount = 0; |
| 469 final long[] delta = new long[1]; | 474 final long[] delta = new long[1]; |
| 470 ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { | 475 ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { |
| 471 @Override | 476 @Override |
| 472 public void run(IProgressMonitor monitor) throws CoreException { | 477 public void run(IProgressMonitor monitor) throws CoreException { |
| 473 long start = System.currentTimeMillis(); | 478 long start = System.currentTimeMillis(); |
| 474 scanWithParticipant(project); | 479 scanWithParticipant(project); |
| 475 delta[0] = System.currentTimeMillis() - start; | 480 delta[0] = System.currentTimeMillis() - start; |
| 476 } | 481 } |
| 477 }, null); | 482 }, null); |
| 478 System.out.println("IRes: " + fileCount + " (" + dartCount + ") files in " +
delta[0] | 483 System.out.println( |
| 479 + " ms in " + contextCount + " contexts"); | 484 "IRes: " + fileCount + " (" + dartCount + ") files in " + delta[0] + " m
s in " |
| 485 + contextCount + " contexts"); |
| 480 } | 486 } |
| 481 | 487 |
| 482 private void scanFiles(File dir) { | 488 private void scanFiles(File dir) { |
| 483 String[] names = dir.list(); | 489 String[] names = dir.list(); |
| 484 for (String name : names) { | 490 for (String name : names) { |
| 485 checkName(name); | 491 checkName(name); |
| 486 File file = new File(dir, name); | 492 File file = new File(dir, name); |
| 487 if (file.isDirectory()) { | 493 if (file.isDirectory()) { |
| 488 scanFiles(file); | 494 scanFiles(file); |
| 489 } | 495 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 IProgressMonitor monitor = new NullProgressMonitor(); | 550 IProgressMonitor monitor = new NullProgressMonitor(); |
| 545 MockWorkspace workspace = new MockWorkspace(); | 551 MockWorkspace workspace = new MockWorkspace(); |
| 546 final AnalysisEngineParticipant participant = new AnalysisEngineParticipant( | 552 final AnalysisEngineParticipant participant = new AnalysisEngineParticipant( |
| 547 new MockProjectManagerForScan(), | 553 new MockProjectManagerForScan(), |
| 548 new AnalysisMarkerManager(workspace)) { | 554 new AnalysisMarkerManager(workspace)) { |
| 549 | 555 |
| 550 @Override | 556 @Override |
| 551 protected DeltaProcessor createProcessor(Project project) { | 557 protected DeltaProcessor createProcessor(Project project) { |
| 552 return new DeltaProcessor(project) { | 558 return new DeltaProcessor(project) { |
| 553 @Override | 559 @Override |
| 554 protected boolean visitPackagesProxy(IResourceProxy proxy, String name
, File packageDir, | 560 protected boolean visitPackagesProxy( |
| 555 IPath packagePath) { | 561 IResourceProxy proxy, String name, File packageDir, IPath packageP
ath) { |
| 556 checkName(name); | 562 checkName(name); |
| 557 return super.visitPackagesProxy(proxy, name, packageDir, packagePath
); | 563 return super.visitPackagesProxy(proxy, name, packageDir, packagePath
); |
| 558 } | 564 } |
| 559 | 565 |
| 560 @Override | 566 @Override |
| 561 protected boolean visitProxy(IResourceProxy proxy, String name) { | 567 protected boolean visitProxy(IResourceProxy proxy, String name) { |
| 562 checkName(name); | 568 checkName(name); |
| 563 return super.visitProxy(proxy, name); | 569 return super.visitProxy(proxy, name); |
| 564 } | 570 } |
| 565 }; | 571 }; |
| 566 } | 572 } |
| 567 }; | 573 }; |
| 568 participant.build(new BuildEvent(project, null, monitor), monitor); | 574 participant.build(new BuildEvent(project, null, monitor), monitor); |
| 569 } | 575 } |
| 570 } | 576 } |
| OLD | NEW |