Remove static initializer for SkOpts::Init()
Static initializers run in a confusing unspecified order, so it's best to have as few of them as possible. Most tools and clients I can find already call SkGraphics::Init(), (or equivalently create an SkAutoGraphics) which calls SkOpts::Init(): - Chrome - Chrome renderer - Android - DM - nanobench - SampleApp - VisualBench - the old debugger Seems like the only thing relying on this static initializer today is the new debugger, fixed here. TBR=reed@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1903503002 Review URL: https://codereview.chromium.org/1903503002
This commit is contained in:
parent
a7c9d6303a
commit
05db63b5fc
@ -141,10 +141,4 @@ namespace SkOpts {
|
||||
static SkOnce once;
|
||||
once(init);
|
||||
}
|
||||
|
||||
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
|
||||
static struct AutoInit {
|
||||
AutoInit() { Init(); }
|
||||
} gAutoInit;
|
||||
#endif
|
||||
}
|
||||
} // namespace SkOpts
|
||||
|
@ -17,7 +17,7 @@ struct ProcCoeff;
|
||||
namespace SkOpts {
|
||||
// Call to replace pointers to portable functions with pointers to CPU-specific functions.
|
||||
// Thread-safe and idempotent.
|
||||
// Called by SkGraphics::Init(), and automatically #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS.
|
||||
// Called by SkGraphics::Init().
|
||||
void Init();
|
||||
|
||||
// Declare function pointers here...
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "Response.h"
|
||||
|
||||
#include "SkCommandLineFlags.h"
|
||||
#include "SkGraphics.h"
|
||||
|
||||
#include "microhttpd.h"
|
||||
|
||||
@ -80,6 +81,7 @@ int answer_to_connection(void* cls, struct MHD_Connection* connection,
|
||||
}
|
||||
|
||||
int skiaserve_main() {
|
||||
SkGraphics::Init();
|
||||
Request request(SkString("/data")); // This simple server has one request
|
||||
|
||||
struct sockaddr_in address;
|
||||
|
Loading…
Reference in New Issue
Block a user