1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/base/cocoa/remote_layer_api.h"
7 #include <objc/runtime.h>
11 bool RemoteLayerAPISupported() {
12 // Verify the GPU process interfaces are present.
13 static Class caContextClass = NSClassFromString(@"CAContext");
17 // Note that because the contextId and layer properties are dynamic,
18 // instancesRespondToSelector will return NO for them.
19 static bool caContextClassValid =
20 [caContextClass respondsToSelector:
21 @selector(contextWithCGSConnection:options:)] &&
22 class_getProperty(caContextClass, "contextId") &&
23 class_getProperty(caContextClass, "layer");
24 if (!caContextClassValid)
27 // Verify the browser process interfaces are present.
28 static Class caLayerHostClass = NSClassFromString(@"CALayerHost");
29 if (!caLayerHostClass)
32 static bool caLayerHostClassValid =
33 [caLayerHostClass instancesRespondToSelector:@selector(contextId)] &&
34 [caLayerHostClass instancesRespondToSelector:@selector(setContextId:)];
35 if (!caLayerHostClassValid)
38 // If everything is there, we should be able to use the API.