ARDUtilities.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright 2014 The WebRTC Project Authors. All rights reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #import <Foundation/Foundation.h>
  11. @interface NSDictionary (ARDUtilites)
  12. // Creates a dictionary with the keys and values in the JSON object.
  13. + (NSDictionary *)dictionaryWithJSONString:(NSString *)jsonString;
  14. + (NSDictionary *)dictionaryWithJSONData:(NSData *)jsonData;
  15. @end
  16. @interface NSURLConnection (ARDUtilities)
  17. // Issues an asynchronous request that calls back on main queue.
  18. + (void)sendAsyncRequest:(NSURLRequest *)request
  19. completionHandler:(void (^)(NSURLResponse *response,
  20. NSData *data,
  21. NSError *error))completionHandler;
  22. // Posts data to the specified URL.
  23. + (void)sendAsyncPostToURL:(NSURL *)url
  24. withData:(NSData *)data
  25. completionHandler:(void (^)(BOOL succeeded,
  26. NSData *data))completionHandler;
  27. @end
  28. NSInteger ARDGetCpuUsagePercentage();