OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "ui/base/cocoa/remote_layer_api.h" | |
6 | |
7 #include <objc/runtime.h> | |
8 | |
9 namespace ui { | |
10 | |
11 bool RemoteLayerAPISupported() { | |
12 // Verify the GPU process interfaces are present. | |
13 static Class caContextClass = NSClassFromString(@"CAContext"); | |
14 if (!caContextClass) | |
15 return false; | |
16 | |
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:)] && | |
Avi (use Gerrit)
2014/06/20 00:15:11
no space
ccameron
2014/06/20 00:55:06
Done.
| |
22 class_getProperty(caContextClass, "contextId") && | |
23 class_getProperty(caContextClass, "layer"); | |
24 if (!caContextClassValid) | |
25 return false; | |
26 | |
27 // Verify the browser process interfaces are present. | |
28 static Class caLayerHostClass = NSClassFromString(@"CALayerHost"); | |
29 if (!caLayerHostClass) | |
30 return false; | |
31 | |
32 static bool caLayerHostClassValid = | |
33 [caLayerHostClass instancesRespondToSelector:@selector(contextId)] && | |
34 [caLayerHostClass instancesRespondToSelector:@selector(setContextId:)]; | |
35 if (!caLayerHostClassValid) | |
36 return false; | |
37 | |
38 // If everything is there, we should be able to use the API. | |
39 return true; | |
40 } | |
41 | |
42 } // namespace | |
43 | |
OLD | NEW |