Skip to content

Commit

Permalink
Merge "ui: move most state from Globals to AppImpl" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
primiano authored and Gerrit Code Review committed Sep 23, 2024
2 parents 81b4e0a + 8a4e5e8 commit f0d6bcb
Show file tree
Hide file tree
Showing 22 changed files with 750 additions and 639 deletions.
2 changes: 1 addition & 1 deletion python/tools/check_ratchet.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

from dataclasses import dataclass

EXPECTED_ANY_COUNT = 61
EXPECTED_ANY_COUNT = 58
EXPECTED_RUN_METRIC_COUNT = 5

ROOT_DIR = os.path.dirname(
Expand Down
18 changes: 0 additions & 18 deletions ui/src/common/arg_types.ts

This file was deleted.

3 changes: 0 additions & 3 deletions ui/src/common/empty_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ export function createEmptyState(): State {
chromeCategories: undefined,
nonSerializableState: createEmptyNonSerializableState(),

// Somewhere to store plugins' persistent state.
plugins: {},

trackFilterTerm: undefined,
forceRunControllers: 0,
};
Expand Down
46 changes: 46 additions & 0 deletions ui/src/common/fake_trace_impl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (C) 2024 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import {Time} from '../base/time';
import {AppImpl} from '../core/app_trace_impl';
import {TraceInfo} from '../public/trace_info';
import {EngineBase} from '../trace_processor/engine';

class FakeEngine extends EngineBase {
id: string = 'TestEngine';

rpcSendRequestBytes(_data: Uint8Array) {
throw new Error('FakeEngine.query() should never be reached');
}
}

// This is used:
// - For testing.
// - By globals.ts before we have an actual trace loaded, to avoid causing
// if (!= undefined) checks everywhere.
export function createFakeTraceImpl() {
const fakeTraceInfo: TraceInfo = {
source: {type: 'URL', url: ''},
traceTitle: '',
traceUrl: '',
start: Time.fromSeconds(0),
end: Time.fromSeconds(10),
realtimeOffset: Time.ZERO,
utcOffset: Time.ZERO,
traceTzOffset: Time.ZERO,
cpus: [],
gpuCount: 0,
};
return AppImpl.instance.newTraceInstance(new FakeEngine(), fakeTraceInfo);
}
Loading

0 comments on commit f0d6bcb

Please sign in to comment.