Add the interface for safe GL context wrapping and implement on Mac.

Linux implementation will come next.

r? @metajack