/*
 * Copyright (C) 2020 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.
 */

syntax = "proto2";

package perfetto.protos;

// Describes a Chrome thread's attributes. Emitted as part of a TrackDescriptor,
// usually by the thread's trace writer. Must be paired with a ThreadDescriptor
// in the same TrackDescriptor.
//
// Next id: 3.
message ChromeThreadDescriptor {
  enum ThreadType {
    THREAD_UNSPECIFIED = 0;

    THREAD_MAIN = 1;
    THREAD_IO = 2;

    THREAD_POOL_BG_WORKER = 3;
    THREAD_POOL_FG_WORKER = 4;
    THREAD_POOL_FG_BLOCKING = 5;
    THREAD_POOL_BG_BLOCKING = 6;
    THREAD_POOL_SERVICE = 7;

    THREAD_COMPOSITOR = 8;
    THREAD_VIZ_COMPOSITOR = 9;
    THREAD_COMPOSITOR_WORKER = 10;

    THREAD_SERVICE_WORKER = 11;
    THREAD_NETWORK_SERVICE = 12;

    THREAD_CHILD_IO = 13;
    THREAD_BROWSER_IO = 14;

    THREAD_BROWSER_MAIN = 15;
    THREAD_RENDERER_MAIN = 16;
    THREAD_UTILITY_MAIN = 17;
    THREAD_GPU_MAIN = 18;

    THREAD_CACHE_BLOCKFILE = 19;
    THREAD_MEDIA = 20;
    THREAD_AUDIO_OUTPUTDEVICE = 21;
    THREAD_AUDIO_INPUTDEVICE = 22;
    THREAD_GPU_MEMORY = 23;
    THREAD_GPU_VSYNC = 24;
    THREAD_DXA_VIDEODECODER = 25;
    THREAD_BROWSER_WATCHDOG = 26;
    THREAD_WEBRTC_NETWORK = 27;
    THREAD_WINDOW_OWNER = 28;
    THREAD_WEBRTC_SIGNALING = 29;
    THREAD_WEBRTC_WORKER = 30;
    THREAD_PPAPI_MAIN = 31;
    THREAD_GPU_WATCHDOG = 32;
    THREAD_SWAPPER = 33;
    THREAD_GAMEPAD_POLLING = 34;
    THREAD_WEBCRYPTO = 35;
    THREAD_DATABASE = 36;
    THREAD_PROXYRESOLVER = 37;
    THREAD_DEVTOOLSADB = 38;
    THREAD_NETWORKCONFIGWATCHER = 39;
    THREAD_WASAPI_RENDER = 40;
    THREAD_LOADER_LOCK_SAMPLER = 41;

    THREAD_MEMORY_INFRA = 50;
    THREAD_SAMPLING_PROFILER = 51;
  };

  optional ThreadType thread_type = 1;

  // To support old UI. New UI should determine default sorting by thread_type.
  optional int32 legacy_sort_index = 2;
}
