Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/cocoa/remote_layer_api.h" | 5 #include "ui/base/cocoa/remote_layer_api.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | |
| 8 #include "ui/base/ui_base_switches.h" | |
| 9 | |
| 7 #include <objc/runtime.h> | 10 #include <objc/runtime.h> |
| 8 | 11 |
| 9 namespace ui { | 12 namespace ui { |
| 10 | 13 |
| 11 bool RemoteLayerAPISupported() { | 14 bool RemoteLayerAPISupported() { |
| 15 static bool enabled_at_command_line = | |
|
sky
2014/08/14 00:19:08
Unless there is really a reason to make this stati
ccameron
2014/08/14 00:33:31
Done.
| |
| 16 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 17 switches::kEnableRemoteCoreAnimation); | |
| 18 if (!enabled_at_command_line) | |
| 19 return false; | |
| 20 | |
| 12 // Verify the GPU process interfaces are present. | 21 // Verify the GPU process interfaces are present. |
| 13 static Class caContextClass = NSClassFromString(@"CAContext"); | 22 static Class caContextClass = NSClassFromString(@"CAContext"); |
| 14 if (!caContextClass) | 23 if (!caContextClass) |
| 15 return false; | 24 return false; |
| 16 | 25 |
| 17 // Note that because the contextId and layer properties are dynamic, | 26 // Note that because the contextId and layer properties are dynamic, |
| 18 // instancesRespondToSelector will return NO for them. | 27 // instancesRespondToSelector will return NO for them. |
| 19 static bool caContextClassValid = | 28 static bool caContextClassValid = |
| 20 [caContextClass respondsToSelector: | 29 [caContextClass respondsToSelector: |
| 21 @selector(contextWithCGSConnection:options:)] && | 30 @selector(contextWithCGSConnection:options:)] && |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 34 [caLayerHostClass instancesRespondToSelector:@selector(setContextId:)]; | 43 [caLayerHostClass instancesRespondToSelector:@selector(setContextId:)]; |
| 35 if (!caLayerHostClassValid) | 44 if (!caLayerHostClassValid) |
| 36 return false; | 45 return false; |
| 37 | 46 |
| 38 // If everything is there, we should be able to use the API. | 47 // If everything is there, we should be able to use the API. |
| 39 return true; | 48 return true; |
| 40 } | 49 } |
| 41 | 50 |
| 42 } // namespace | 51 } // namespace |
| 43 | 52 |
| OLD | NEW |