xref: /aosp_15_r20/external/skia/relnotes/precompilecontext.md (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Worker
2*c8dee2aaSAndroid Build Coastguard WorkerA new PrecompileContext object has been added to assist Precompilation. The old API of the form:\
3*c8dee2aaSAndroid Build Coastguard Worker    bool Precompile(Context*, ...);\
4*c8dee2aaSAndroid Build Coastguard Workerhas been deprecated and replaced with the API:\
5*c8dee2aaSAndroid Build Coastguard Worker    bool Precompile(PrecompileContext*, ...)\
6*c8dee2aaSAndroid Build Coastguard WorkerThe new PrecompileContext object can be obtained via the Context::makePrecompileContext call.
7*c8dee2aaSAndroid Build Coastguard Worker
8*c8dee2aaSAndroid Build Coastguard WorkerAs an example of a possible Compilation/Precompilation threading model, one could employ 4 threads:
9*c8dee2aaSAndroid Build Coastguard Worker
10*c8dee2aaSAndroid Build Coastguard Worker2 for creating Recordings (\<r1\> and \<r2\>) \
11*c8dee2aaSAndroid Build Coastguard Worker1 for precompiling (\<p1\>) \
12*c8dee2aaSAndroid Build Coastguard Workerand the main thread - which owns the Context and submits Recordings.
13*c8dee2aaSAndroid Build Coastguard Worker
14*c8dee2aaSAndroid Build Coastguard WorkerStart up for this scenario would look like:
15*c8dee2aaSAndroid Build Coastguard Worker
16*c8dee2aaSAndroid Build Coastguard Worker  the main thread moves a PrecompileContext to <p1> and begins precompiling there\
17*c8dee2aaSAndroid Build Coastguard Worker  the main thread creates two Recorders and moves them to <r1> and <r2> to create Recordings\
18*c8dee2aaSAndroid Build Coastguard Worker  the main thread continues on - calling Context::insertRecording on the posted Recordings.
19*c8dee2aaSAndroid Build Coastguard Worker
20*c8dee2aaSAndroid Build Coastguard WorkerThe PrecompileContext can safely outlive the Context that created it, but it will
21*c8dee2aaSAndroid Build Coastguard Workereffectively be shut down at that point.
22