Arquivos
hhvm/hphp/runtime/ext/ext_curl.h
T
Drew Paroski 84b9d9a3a2 Separate resources from objects, part 1
In HHVM (and HPHPc before it) we've been piggybacking resources on the
KindOfObject machinery. At the language level, resource is considered to
be a different type than object, and there are a number of differences
in behavior between objects and resources (ex. resources don't allow for
dynamic properties, resources don't work with the clone operator, the
"(object)" cast behaves differently for resources vs. objects, etc).

Piggybacking resources on the KindOfObject machinery has some downsides.
Code that deals with KindOfObject values often needs to check if the value
is a resource and go down a different code path. This makes things harder
to maintain and harder to keep parity with Zend. Also, these extra branches
hurt performance a little, and they make it harder for the JIT to do a good
job in some cases when its generating machine code that operates on objects.

This diff prepares the code base for a new KindOfResource type by adding a
new "Resource" smart pointer type (currently a typedef for the Object smart
pointer type) and it updates the C++ code and the idl files appropriately.
This diff is essentially a cosmetic change and should not impact run time
behavior. In the next diff (part 2) we'll actually add a new KindOfResource
type, detach ResourceData from the ObjectData inheritence hierarchy, and
provide a real implementation for the Resource smart pointer type (instead
of just aliasing the Object smart pointer type).
2013-07-10 11:16:33 -07:00

66 linhas
3.1 KiB
C++

/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_EXT_CURL_H_
#define incl_HPHP_EXT_CURL_H_
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
#include "curl/curl.h"
#include "curl/easy.h"
#include "curl/multi.h"
#include "hphp/runtime/base/base_includes.h"
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
Variant f_curl_init(CStrRef url = null_string);
Variant f_curl_copy_handle(CResRef ch);
Variant f_curl_version(int uversion = k_CURLVERSION_NOW);
bool f_curl_setopt(CResRef ch, int option, CVarRef value);
bool f_curl_setopt_array(CResRef ch, CArrRef options);
Variant f_fb_curl_getopt(CResRef ch, int opt = 0);
Variant f_curl_exec(CResRef ch);
Variant f_curl_getinfo(CResRef ch, int opt = 0);
Variant f_curl_errno(CResRef ch);
Variant f_curl_error(CResRef ch);
Variant f_curl_close(CResRef ch);
Resource f_curl_multi_init();
Variant f_curl_multi_add_handle(CResRef mh, CResRef ch);
Variant f_curl_multi_remove_handle(CResRef mh, CResRef ch);
Variant f_curl_multi_exec(CResRef mh, VRefParam still_running);
Variant f_curl_multi_select(CResRef mh, double timeout = 1.0);
Variant f_fb_curl_multi_fdset(CResRef mh, VRefParam read_fd_set, VRefParam write_fd_set, VRefParam exc_fd_set, VRefParam max_fd = null_object);
Variant f_curl_multi_getcontent(CResRef ch);
Variant f_curl_multi_info_read(CResRef mh, VRefParam msgs_in_queue = uninit_null());
Variant f_curl_multi_close(CResRef mh);
void f_evhttp_set_cache(CStrRef address, int max_conn, int port = 80);
Variant f_evhttp_get(CStrRef url, CArrRef headers = null_array, int timeout = 5);
Variant f_evhttp_post(CStrRef url, CStrRef data, CArrRef headers = null_array, int timeout = 5);
Variant f_evhttp_async_get(CStrRef url, CArrRef headers = null_array, int timeout = 5);
Variant f_evhttp_async_post(CStrRef url, CStrRef data, CArrRef headers = null_array, int timeout = 5);
Variant f_evhttp_recv(CResRef handle);
extern const int64_t k_CURLINFO_LOCAL_PORT;
extern const int64_t k_CURLOPT_TIMEOUT_MS;
extern const int64_t k_CURLOPT_CONNECTTIMEOUT_MS;
///////////////////////////////////////////////////////////////////////////////
}
#endif // incl_HPHP_EXT_CURL_H_