Threading and Tasks in Chrome

 

Threading and Tasks in Chrome

Overview

Chromium is a very multithreaded product. We try to keep the UI as responsive as possible, and this means not blocking the UI thread with any blocking I/O or other expensive operations. Our approach is to use message passing as the way of communicating between threads. We discourage locking and threadsafe objects. Instead, objects live on only one thread, we pass messages between threads for communication, and we use callback interfaces (implemented by message passing) for most cross-thread requests.

Threads

Every Chrome process has

  • a main thread
    • in the browser process: updates the UI
    • in renderer processes: runs most of Blink
  • an IO thread
    • in the browser process: handles IPCs and network requests
    • in renderer processes: handles IPCs
  • a few more special-purpose threads
  • and a pool of general-purpose threads

Most threads have a loop that gets tasks from a queue and runs them (the queue may be shared between multiple threads).

Tasks

A task is a base::OnceClosure added to a queue for asynchronous execution.

base::OnceClosure stores a function pointer and arguments. It has a Run() method that invokes the function pointer using the bound arguments. It is created using base::BindOnce. (ref. Callback<> and Bind() documentation).

void TaskA() {}
void TaskB(int v) {}

auto task_a = base::BindOnce(&TaskA);
auto task_b = base::BindOnce(&TaskB, 42);

A group of tasks can be executed in one of the following ways:

  • Parallel: No task execution ordering, possibly all at once on any thread
  • Sequenced: Tasks executed in posting order, one at a time on any thread.
  • Single Threaded: Tasks executed in posting order, one at a time on a single thread.

Prefer Sequences to Threads

Sequenced execution mode is far preferred to Single Threaded in scenarios that require mere thread-safety as it opens up scheduling paradigms that wouldn‘t be possible otherwise (sequences can hop threads instead of being stuck behind unrelated work on a dedicated thread). Ability to hop threads also means the thread count can dynamically adapt to the machine’s true resource availability (increased parallelism on bigger machines, avoids trashing resources on smaller machines).

Many core APIs were recently made sequence-friendly (classes are rarely thread-affine -- i.e. only when using thread-local-storage or third-party APIs that do). But the codebase has long evolved assuming single-threaded contexts... If your class could run on a sequence but is blocked by an overzealous use of ThreadChecker/ThreadTaskRunnerHandle/SingleThreadTaskRunner in a leaf dependency, consider fixing that dependency for everyone's benefit (or at the very least file a blocking bug against https://crbug.com/675631 and flag your use of base::CreateSingleThreadTaskRunnerWithTraits() with a TODO against your bug to use base::CreateSequencedTaskRunnerWithTraits() when fixed).

Detailed documentation on how to migrate from single-threaded contexts to sequenced contexts can be found here.

The discussion below covers all of these ways to execute tasks in details.

Posting a Parallel Task

Direct Posting to the Task Scheduler

A task that can run on any thread and doesn’t have ordering or mutual exclusion requirements with other tasks should be posted using one of the base::PostTask*() functions defined in base/task/post_task.h.

base::PostTask(FROM_HERE, base::BindOnce(&Task));

This posts tasks with default traits.

The base::PostTask*WithTraits() functions allow the caller to provide additional details about the task via TaskTraits (ref. Annotating Tasks with TaskTraits).

base::PostTaskWithTraits(
    FROM_HERE, {base::TaskPriority::BEST_EFFORT, MayBlock()}, base::BindOnce(&Task));

Posting via a TaskRunner

A parallel TaskRunner is an alternative to calling base::PostTask*() directly. This is mainly useful when it isn’t known in advance whether tasks will be posted in parallel, in sequence, or to a single-thread (ref. Posting a Sequenced TaskPosting Multiple Tasks to the Same Thread). Since TaskRunner is the base class of SequencedTaskRunner and SingleThreadTaskRunner, a scoped_refptr<TaskRunner> member can hold a TaskRunner, a SequencedTaskRunner or a SingleThreadTaskRunner.

class A {
 public: A() = default; void set_task_runner_for_testing( scoped_refptr<base::TaskRunner> task_runner) { task_runner_ = std::move(task_runner); } void DoSomething() { // In production, A is always posted in parallel. In test, it is posted to // the TaskRunner provided via set_task_runner_for_testing(). task_runner_->PostTask(FROM_HERE, base::BindOnce(&A)); } private: scoped_refptr<base::TaskRunner> task_runner_ = base::CreateTaskRunnerWithTraits({base::TaskPriority::USER_VISIBLE}); };

Unless a test needs to control precisely how tasks are executed, it is preferred to call base::PostTask*() directly (ref. Testing for less invasive ways of controlling tasks in tests).

Posting a Sequenced Task

A sequence is a set of tasks that run one at a time in posting order (not necessarily on the same thread). To post tasks as part of a sequence, use a SequencedTaskRunner.

Posting to a New Sequence

SequencedTaskRunner can be created by base::CreateSequencedTaskRunnerWithTraits().

scoped_refptr<SequencedTaskRunner> sequenced_task_runner = base::CreateSequencedTaskRunnerWithTraits(...); // TaskB runs after TaskA completes. sequenced_task_runner->PostTask(FROM_HERE, base::BindOnce(&TaskA)); sequenced_task_runner->PostTask(FROM_HERE, base::BindOnce(&TaskB));

Posting to the Current Sequence

The SequencedTaskRunner to which the current task was posted can be obtained via SequencedTaskRunnerHandle::Get().

NOTE: it is invalid to call  SequencedTaskRunnerHandle::Get() from a parallel task, but it is valid from a single-threaded task (a  SingleThreadTaskRunner is a  SequencedTaskRunner).
// The task will run after any task that has already been posted
// to the SequencedTaskRunner to which the current task was posted
// (in particular, it will run after the current task completes). // It is also guaranteed that it won’t run concurrently with any // task posted to that SequencedTaskRunner. base::SequencedTaskRunnerHandle::Get()-> PostTask(FROM_HERE, base::BindOnce(&Task));

Using Sequences Instead of Locks

Usage of locks is discouraged in Chrome. Sequences inherently provide thread-safety. Prefer classes that are always accessed from the same sequence to managing your own thread-safety with locks.

class A {
 public: A() { // Do not require accesses to be on the creation sequence. DETACH_FROM_SEQUENCE(sequence_checker_); } void AddValue(int v) { // Check that all accesses are on the same sequence. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); values_.push_back(v); } private: SEQUENCE_CHECKER(sequence_checker_); // No lock required, because all accesses are on the // same sequence. std::vector<int> values_; }; A a; scoped_refptr<SequencedTaskRunner> task_runner_for_a = ...; task_runner_for_a->PostTask(FROM_HERE, base::BindOnce(&A::AddValue, base::Unretained(&a), 42)); task_runner_for_a->PostTask(FROM_HERE, base::BindOnce(&A::AddValue, base::Unretained(&a), 27)); // Access from a different sequence causes a DCHECK failure. scoped_refptr<SequencedTaskRunner> other_task_runner = ...; other_task_runner->PostTask(FROM_HERE, base::BindOnce(&A::AddValue, base::Unretained(&a), 1));

Locks should only be used to swap in a shared data structure that can be accessed on multiple threads. If one thread updates it based on expensive computation or through disk access, then that slow work should be done without holding on to the lock. Only when the result is available should the lock be used to swap in the new data. An example of this is in PluginList::LoadPlugins ([content/common/plugin_list.cc](https://cs.chromium.org/chromium/src/content/ common/plugin_list.cc). If you must use locks, here are some best practices and pitfalls to avoid.

In order to write non-blocking code, many APIs in Chromium are asynchronous. Usually this means that they either need to be executed on a particular thread/sequence and will return results via a custom delegate interface, or they take a base::Callback<> object that is called when the requested operation is completed. Executing work on a specific thread/sequence is covered in the PostTask sections above.

Posting Multiple Tasks to the Same Thread

If multiple tasks need to run on the same thread, post them to a SingleThreadTaskRunner. All tasks posted to the same SingleThreadTaskRunner run on the same thread in posting order.

Posting to the Main Thread or to the IO Thread in the Browser Process

To post tasks to the main thread or to the IO thread, use base::PostTaskWithTraits() or get the appropriate SingleThreadTaskRunner using base::CreateSingleThreadTaskRunnerWithTraits, supplying a BrowserThread::ID as trait. For this, you'll also need to include content/public/browser/browser_task_traits.h.

base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI}, ...); base::CreateSingleThreadTaskRunnerWithTraits({content::BrowserThread::IO}) ->PostTask(FROM_HERE, ...);

The main thread and the IO thread are already super busy. Therefore, prefer posting to a general purpose thread when possible (ref. Posting a Parallel TaskPosting a Sequenced task). Good reasons to post to the main thread are to update the UI or access objects that are bound to it (e.g. Profile). A good reason to post to the IO thread is to access the internals of components that are bound to it (e.g. IPCs, network). Note: It is not necessary to have an explicit post task to the IO thread to send/receive an IPC or send/receive data on the network.

Posting to the Main Thread in a Renderer Process

TODO

Posting to a Custom SingleThreadTaskRunner

If multiple tasks need to run on the same thread and that thread doesn’t have to be the main thread or the IO thread, post them to a SingleThreadTaskRunner created by base::CreateSingleThreadTaskRunnerWithTraits.

scoped_refptr<SequencedTaskRunner> single_thread_task_runner = base::CreateSingleThreadTaskRunnerWithTraits(...); // TaskB runs after TaskA completes. Both tasks run on the same thread. single_thread_task_runner->PostTask(FROM_HERE, base::BindOnce(&TaskA)); single_thread_task_runner->PostTask(FROM_HERE, base::BindOnce(&TaskB));
IMPORTANT: You should rarely need this, most classes in Chromium require thread-safety (which sequences provide) not thread-affinity. If an API you’re using is incorrectly thread-affine (i.e. using  base::ThreadChecker when it’s merely thread-unsafe and should use  base::SequenceChecker), please consider fixing it instead of making things worse by also making your API thread-affine.

Posting to the Current Thread

IMPORTANT: To post a task that needs mutual exclusion with the current sequence of tasks but doesn’t absolutely need to run on the current thread, use  SequencedTaskRunnerHandle::Get() instead of  ThreadTaskRunnerHandle::Get() (ref.  Posting to the Current Sequence). That will better document the requirements of the posted task. In a single-thread task,  SequencedTaskRunnerHandle::Get() is equivalent to  ThreadTaskRunnerHandle::Get().

To post a task to the current thread, use ThreadTaskRunnerHandle.

// The task will run on the current thread in the future.
base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&Task));
NOTE: It is invalid to call  ThreadTaskRunnerHandle::Get() from a parallel or a sequenced task.

Posting Tasks to a COM Single-Thread Apartment (STA) Thread (Windows)

Tasks that need to run on a COM Single-Thread Apartment (STA) thread must be posted to a SingleThreadTaskRunner returned by CreateCOMSTATaskRunnerWithTraits(). As mentioned in Posting Multiple Tasks to the Same Thread, all tasks posted to the same SingleThreadTaskRunner run on the same thread in posting order.

// Task(A|B|C)UsingCOMSTA will run on the same COM STA thread.

void TaskAUsingCOMSTA() { // [ This runs on a COM STA thread. ] // Make COM STA calls. // ... // Post another task to the current COM STA thread. base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&TaskCUsingCOMSTA)); } void TaskBUsingCOMSTA() { } void TaskCUsingCOMSTA() { } auto com_sta_task_runner = base::CreateCOMSTATaskRunnerWithTraits(...); com_sta_task_runner->PostTask(FROM_HERE, base::BindOnce(&TaskAUsingCOMSTA)); com_sta_task_runner->PostTask(FROM_HERE, base::BindOnce(&TaskBUsingCOMSTA));

Annotating Tasks with TaskTraits

TaskTraits encapsulate information about a task that helps the task scheduler make better scheduling decisions.

All PostTask*() functions in base/task/post_task.h have an overload that takes TaskTraits as argument and one that doesn’t. The overload that doesn’t take TaskTraits as argument is appropriate for tasks that:

  • Don’t block (ref. MayBlock and WithBaseSyncPrimitives).
  • Prefer inheriting the current priority to specifying their own.
  • Can either block shutdown or be skipped on shutdown (task scheduler is free to choose a fitting default). Tasks that don’t match this description must be posted with explicit TaskTraits.

base/task/task_traits.h provides exhaustive documentation of available traits. The content layer also provides additional traits in content/public/browser/browser_task_traits.h to facilitate posting a task onto a BrowserThread.

Below are some examples of how to specify TaskTraits.

// This task has no explicit TaskTraits. It cannot block. Its priority
// is inherited from the calling context (e.g. if it is posted from
// a BEST_EFFORT task, it will have a BEST_EFFORT priority). It will either // block shutdown or be skipped on shutdown. base::PostTask(FROM_HERE, base::BindOnce(...)); // This task has the highest priority. The task scheduler will try to // run it before USER_VISIBLE and BEST_EFFORT tasks. base::PostTaskWithTraits( FROM_HERE, {base::TaskPriority::USER_BLOCKING}, base::BindOnce(...)); // This task has the lowest priority and is allowed to block (e.g. it // can read a file from disk). base::PostTaskWithTraits( FROM_HERE, {base::TaskPriority::BEST_EFFORT, base::MayBlock()}, base::BindOnce(...)); // This task blocks shutdown. The process won't exit before its // execution is complete. base::PostTaskWithTraits( FROM_HERE, {base::TaskShutdownBehavior::BLOCK_SHUTDOWN}, base::BindOnce(...)); // This task will run on the Browser UI thread. base::PostTaskWithTraits( FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(...));

Keeping the Browser Responsive

Do not perform expensive work on the main thread, the IO thread or any sequence that is expected to run tasks with a low latency. Instead, perform expensive work asynchronously using base::PostTaskAndReply*() or SequencedTaskRunner::PostTaskAndReply(). Note that asynchronous/overlapped I/O on the IO thread are fine.

Example: Running the code below on the main thread will prevent the browser from responding to user input for a long time.

// GetHistoryItemsFromDisk() may block for a long time.
// AddHistoryItemsToOmniboxDropDown() updates the UI and therefore must
// be called on the main thread. AddHistoryItemsToOmniboxDropdown(GetHistoryItemsFromDisk("keyword"));

The code below solves the problem by scheduling a call to GetHistoryItemsFromDisk() in a thread pool followed by a call to AddHistoryItemsToOmniboxDropdown() on the origin sequence (the main thread in this case). The return value of the first call is automatically provided as argument to the second call.

base::PostTaskWithTraitsAndReplyWithResult(
    FROM_HERE, {base::MayBlock()}, base::BindOnce(&GetHistoryItemsFromDisk, "keyword"), base::BindOnce(&AddHistoryItemsToOmniboxDropdown));

Posting a Task with a Delay

Posting a One-Off Task with a Delay

To post a task that must run once after a delay expires, use base::PostDelayedTask*() or TaskRunner::PostDelayedTask().

base::PostDelayedTaskWithTraits(
  FROM_HERE, {base::TaskPriority::BEST_EFFORT}, base::BindOnce(&Task), base::TimeDelta::FromHours(1)); scoped_refptr<base::SequencedTaskRunner> task_runner = base::CreateSequencedTaskRunnerWithTraits({base::TaskPriority::BEST_EFFORT}); task_runner->PostDelayedTask( FROM_HERE, base::BindOnce(&Task), base::TimeDelta::FromHours(1));
NOTE: A task that has a 1-hour delay probably doesn’t have to run right away when its delay expires. Specify  base::TaskPriority::BEST_EFFORT to prevent it from slowing down the browser when its delay expires.

Posting a Repeating Task with a Delay

To post a task that must run at regular intervals, use base::RepeatingTimer.

class A {
 public: ~A() { // The timer is stopped automatically when it is deleted. } void StartDoingStuff() { timer_.Start(FROM_HERE, TimeDelta::FromSeconds(1), this, &MyClass::DoStuff); } void StopDoingStuff() { timer_.Stop(); } private: void DoStuff() { // This method is called every second on the sequence that invoked // StartDoingStuff(). } base::RepeatingTimer timer_; };

Cancelling a Task

Using base::WeakPtr

base::WeakPtr can be used to ensure that any callback bound to an object is canceled when that object is destroyed.

int Compute() {  } class A { public: A() : weak_ptr_factory_(this) {} void ComputeAndStore() { // Schedule a call to Compute() in a thread pool followed by // a call to A::Store() on the current sequence. The call to // A::Store() is canceled when |weak_ptr_factory_| is destroyed. // (guarantees that |this| will not be used-after-free). base::PostTaskAndReplyWithResult( FROM_HERE, base::BindOnce(&Compute), base::BindOnce(&A::Store, weak_ptr_factory_.GetWeakPtr())); } private: void Store(int value) { value_ = value; } int value_; base::WeakPtrFactory<A> weak_ptr_factory_; };

Note: WeakPtr is not thread-safe: GetWeakPtr()~WeakPtrFactory(), and Compute() (bound to a WeakPtr) must all run on the same sequence.

Using base::CancelableTaskTracker

base::CancelableTaskTracker allows cancellation to happen on a different sequence than the one on which tasks run. Keep in mind that CancelableTaskTracker cannot cancel tasks that have already started to run.

auto task_runner = base::CreateTaskRunnerWithTraits(base::TaskTraits()); base::CancelableTaskTracker cancelable_task_tracker; cancelable_task_tracker.PostTask(task_runner.get(), FROM_HERE, base::DoNothing()); // Cancels Task(), only if it hasn't already started running. cancelable_task_tracker.TryCancelAll();

Testing

To test code that uses base::ThreadTaskRunnerHandlebase::SequencedTaskRunnerHandle or a function in base/task/post_task.h, instantiate a base::test::ScopedTaskEnvironment for the scope of the test.

class MyTest : public testing::Test { public: // ... protected: base::test::ScopedTaskEnvironment scoped_task_environment_; }; TEST(MyTest, MyTest) { base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::BindOnce(&A)); base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::BindOnce(&B)); base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::BindOnce(&C), base::TimeDelta::Max()); // This runs the (Thread|Sequenced)TaskRunnerHandle queue until it is empty. // Delayed tasks are not added to the queue until they are ripe for execution. base::RunLoop().RunUntilIdle(); // A and B have been executed. C is not ripe for execution yet. base::RunLoop run_loop; base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::BindOnce(&D)); base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, run_loop.QuitClosure()); base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::BindOnce(&E)); // This runs the (Thread|Sequenced)TaskRunnerHandle queue until QuitClosure is // invoked. run_loop.Run(); // D and run_loop.QuitClosure() have been executed. E is still in the queue. // Tasks posted to task scheduler run asynchronously as they are posted. base::PostTaskWithTraits(FROM_HERE, base::TaskTraits(), base::BindOnce(&F)); auto task_runner = base::CreateSequencedTaskRunnerWithTraits(base::TaskTraits()); task_runner->PostTask(FROM_HERE, base::BindOnce(&G)); // To block until all tasks posted to task scheduler are done running: base::TaskScheduler::GetInstance()->FlushForTesting(); // F and G have been executed. base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, base::TaskTrait(), base::BindOnce(&H), base::BindOnce(&I)); // This runs the (Thread|Sequenced)TaskRunnerHandle queue until both the

转载于:https://www.cnblogs.com/huangguanyuan/p/9673364.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
优化import os.path import pprint import textwrap import threading import time import requests import re import json from queue import Queue q_list = Queue(100) from threading import Thread headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 ' 'Safari/537.36' } # 获取m3u8视频片段的所有地址 def get_links(url): # 获取视频页的网页源代码 r = requests.get(url, headers=headers) info = re.findall('window.pageInfo = window.videoInfo =(.*?)window.videoResource', r.text, re.DOTALL)[0].strip()[0:-1] # 获取m3u8列表地址 filename = json.loads(info)['title'] m3u8_url = json.loads(json.loads(info)["currentVideoInfo"]["ksPlayJson"])['adaptationSet'][0]['representation'][1]['url'] m3u8_list = requests.get(m3u8_url, headers=headers).text ts_files = re.sub('#.*', '', m3u8_list).split() ts_length = len(ts_files) # 获取m3u8地址片段 for num, ts in enumerate(ts_files): ts_url = 'https://ali-safety-video.acfun.cn/mediacloud/acfun/acfun_video/' + ts q_list.put([ts_url, num]) return filename, ts_length # print(filename, ts_url) # 分别下载这些视频片段-多线程 def download(filename): while not q_list.empty(): ts_url, num = q_list.get() video_content = requests.get(ts_url, headers=headers).content with open(f'video/{filename}_{num}.ts', 'wb') as f: f.write(video_content) print(f'{threading.current_thread().name}已下载...第{num}个片段') # 合并视频-构成完整的片段 def combine(filename, ts_length): fp = open(f'video/{filename}.mp4', 'ab') for i in range(ts_length): if os.path.exists(f'video/{filename}_{i}.ts'): with open(f'video/{filename}_{i}.ts', 'rb') as f: ts_slice = f.read() fp.write(ts_slice) print(f'已合并...第{i}个片段') os.remove(f'video/{filename}_{i}.ts') print(f'已删除...第{i}个片段') fp.close() # 主文件调用 def main(): start_time = time.time() url = 'https://www.acfun.cn/v/ac41409604' filename, ts_length = get_links(url) tasks = [] for i in range(3): th = Thread(target=download, args=(filename,), name=f'线程{i}') th.start() tasks.append(th) for t in tasks: t.join() combine(filename, ts_length) end_time = time.time() print(f'总共耗时{end_time - start_time}')
05-22
目标检测(Object Detection)是计算机视觉领域的一个核心问题,其主要任务是找出图像中所有感兴趣的目标(物体),并确定它们的类别和位置。以下是对目标检测的详细阐述: 一、基本概念 目标检测的任务是解决“在哪里?是什么?”的问题,即定位出图像中目标的位置并识别出目标的类别。由于各类物体具有不同的外观、形状和姿态,加上成像时光照、遮挡等因素的干扰,目标检测一直是计算机视觉领域最具挑战性的任务之一。 二、核心问题 目标检测涉及以下几个核心问题: 分类问题:判断图像中的目标属于哪个类别。 定位问题:确定目标在图像中的具体位置。 大小问题:目标可能具有不同的大小。 形状问题:目标可能具有不同的形状。 三、算法分类 基于深度学习的目标检测算法主要分为两大类: Two-stage算法:先进行区域生成(Region Proposal),生成有可能包含待检物体的预选框(Region Proposal),再通过卷积神经网络进行样本分类。常见的Two-stage算法包括R-CNN、Fast R-CNN、Faster R-CNN等。 One-stage算法:不用生成区域提议,直接在网络中提取特征来预测物体分类和位置。常见的One-stage算法包括YOLO系列(YOLOv1、YOLOv2、YOLOv3、YOLOv4、YOLOv5等)、SSD和RetinaNet等。 四、算法原理 以YOLO系列为例,YOLO将目标检测视为回归问题,将输入图像一次性划分为多个区域,直接在输出层预测边界框和类别概率。YOLO采用卷积网络来提取特征,使用全连接层来得到预测值。其网络结构通常包含多个卷积层和全连接层,通过卷积层提取图像特征,通过全连接层输出预测结果。 五、应用领域 目标检测技术已经广泛应用于各个领域,为人们的生活带来了极大的便利。以下是一些主要的应用领域: 安全监控:在商场、银行
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值