unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
104,785 | 0 | bool ValidatePageElement(TabContents* tab,
const std::wstring& frame,
const std::wstring& javascript,
const std::string& expected_value) {
std::string returned_value;
std::string error;
if (!ui_test_utils::ExecuteJavaScriptAndExtractString(
tab->render_view_host(),
frame,
javascript, &returned_value))
return false;
EXPECT_STREQ(expected_value.c_str(), returned_value.c_str());
return expected_value == returned_value;
}
| 13,800 |
161,845 | 0 | void ClientDiscardableSharedMemoryManager::MemoryUsageChanged(
size_t new_bytes_total,
size_t new_bytes_free) const {
static crash_reporter::CrashKeyString<24> discardable_memory_allocated(
"discardable-memory-allocated");
discardable_memory_allocated.Set(base::NumberToString(new_bytes_total));
static crash_reporter::CrashKeyString<24> discardable_memory_free(
"discardable-memory-free");
discardable_memory_free.Set(base::NumberToString(new_bytes_free));
}
| 13,801 |
141,540 | 0 | void ChooserContextBase::NotifyPermissionRevoked(const GURL& requesting_origin,
const GURL& embedding_origin) {
for (auto& observer : permission_observer_list_) {
observer.OnChooserObjectPermissionChanged(guard_content_settings_type_,
data_content_settings_type_);
observer.OnPermissionRevoked(requesting_origin, embedding_origin);
}
}
| 13,802 |
4,970 | 0 | qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta)
{
GNode *meta;
GNode *ilst;
GNode *node;
gint i;
meta = qtdemux_tree_get_child_by_type (udta, FOURCC_meta);
if (meta != NULL) {
ilst = qtdemux_tree_get_child_by_type (meta, FOURCC_ilst);
if (ilst == NULL) {
GST_LOG_OBJECT (qtdemux, "no ilst");
return;
}
} else {
ilst = udta;
GST_LOG_OBJECT (qtdemux, "no meta so using udta itself");
}
GST_DEBUG_OBJECT (qtdemux, "new tag list");
qtdemux->tag_list = gst_tag_list_new ();
for (i = 0; i < G_N_ELEMENTS (add_funcs); ++i) {
node = qtdemux_tree_get_child_by_type (ilst, add_funcs[i].fourcc);
if (node) {
add_funcs[i].func (qtdemux, add_funcs[i].gst_tag,
add_funcs[i].gst_tag_bis, node);
g_node_destroy (node);
}
}
/* parsed nodes have been removed, pass along remainder as blob */
g_node_children_foreach (ilst, G_TRAVERSE_ALL,
(GNodeForeachFunc) qtdemux_tag_add_blob, qtdemux);
}
| 13,803 |
18,007 | 0 | jbig2_default_free(Jbig2Allocator *allocator, void *p)
{
free(p);
}
| 13,804 |
64,290 | 0 | static const char *set_limit_mem(cmd_parms *cmd, void *conf_,
const char *arg, const char * arg2)
{
core_dir_config *conf = conf_;
#if defined(RLIMIT_AS)
ap_unixd_set_rlimit(cmd, &conf->limit_mem, arg, arg2 ,RLIMIT_AS);
#elif defined(RLIMIT_DATA)
ap_unixd_set_rlimit(cmd, &conf->limit_mem, arg, arg2, RLIMIT_DATA);
#elif defined(RLIMIT_VMEM)
ap_unixd_set_rlimit(cmd, &conf->limit_mem, arg, arg2, RLIMIT_VMEM);
#endif
return NULL;
}
| 13,805 |
33,443 | 0 | int console_trylock(void)
{
if (down_trylock(&console_sem))
return 0;
if (console_suspended) {
up(&console_sem);
return 0;
}
console_locked = 1;
console_may_schedule = 0;
return 1;
}
| 13,806 |
77,024 | 0 | ofpacts_pull(struct ofpbuf *ofpacts)
{
size_t ofs;
ofs = ofpacts->size;
ofpbuf_pull(ofpacts, ofs);
return ofs;
}
| 13,807 |
119,671 | 0 | inline void TrailingObjects::setTrailingWhitespace(RenderText* whitespace)
{
ASSERT(whitespace);
m_whitespace = whitespace;
}
| 13,808 |
102,910 | 0 | ::TabCloseableStateWatcher* ::TabCloseableStateWatcher::Create() {
::TabCloseableStateWatcher* watcher = NULL;
#if defined(OS_CHROMEOS)
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableTabCloseableStateWatcher))
watcher = new chromeos::TabCloseableStateWatcher();
#endif // OS_CHROMEOS
if (!watcher)
watcher = new ::TabCloseableStateWatcher();
return watcher;
}
| 13,809 |
95,393 | 0 | static config_rec *_auth_group(pool *p, char *user, char **group,
char **ournamep, char **anonnamep, char *pass)
{
config_rec *c;
char *ourname = NULL,*anonname = NULL;
char **grmem;
struct group *grp;
ourname = (char*)get_param_ptr(main_server->conf,"UserName",FALSE);
if (ournamep && ourname)
*ournamep = ourname;
c = find_config(main_server->conf, CONF_PARAM, "GroupPassword", TRUE);
if (c) do {
grp = pr_auth_getgrnam(p, c->argv[0]);
if (!grp)
continue;
for (grmem = grp->gr_mem; *grmem; grmem++)
if (strcmp(*grmem, user) == 0) {
if (pr_auth_check(p, c->argv[1], user, pass) == 0)
break;
}
if (*grmem) {
if (group)
*group = c->argv[0];
if (c->parent)
c = c->parent;
if (c->config_type == CONF_ANON)
anonname = (char*)get_param_ptr(c->subset,"UserName",FALSE);
if (anonnamep)
*anonnamep = anonname;
if (anonnamep && !anonname && ourname)
*anonnamep = ourname;
break;
}
} while((c = find_config_next(c,c->next,CONF_PARAM,"GroupPassword",TRUE)) != NULL);
return c;
}
| 13,810 |
70,926 | 0 | int getPixelInterpolated(gdImagePtr im, const double x, const double y, const int bgColor)
{
const int xi=(int)(x);
const int yi=(int)(y);
int yii;
int i;
double kernel, kernel_cache_y;
double kernel_x[12], kernel_y[4];
double new_r = 0.0f, new_g = 0.0f, new_b = 0.0f, new_a = 0.0f;
/* These methods use special implementations */
if (im->interpolation_id == GD_NEAREST_NEIGHBOUR) {
return -1;
}
if (im->interpolation_id == GD_WEIGHTED4) {
return getPixelInterpolateWeight(im, x, y, bgColor);
}
if (im->interpolation_id == GD_NEAREST_NEIGHBOUR) {
if (im->trueColor == 1) {
return getPixelOverflowTC(im, xi, yi, bgColor);
} else {
return getPixelOverflowPalette(im, xi, yi, bgColor);
}
}
if (im->interpolation) {
for (i=0; i<4; i++) {
kernel_x[i] = (double) im->interpolation((double)(xi+i-1-x));
kernel_y[i] = (double) im->interpolation((double)(yi+i-1-y));
}
} else {
return -1;
}
/*
* TODO: use the known fast rgba multiplication implementation once
* the new formats are in place
*/
for (yii = yi-1; yii < yi+3; yii++) {
int xii;
kernel_cache_y = kernel_y[yii-(yi-1)];
if (im->trueColor) {
for (xii=xi-1; xii<xi+3; xii++) {
const int rgbs = getPixelOverflowTC(im, xii, yii, bgColor);
kernel = kernel_cache_y * kernel_x[xii-(xi-1)];
new_r += kernel * gdTrueColorGetRed(rgbs);
new_g += kernel * gdTrueColorGetGreen(rgbs);
new_b += kernel * gdTrueColorGetBlue(rgbs);
new_a += kernel * gdTrueColorGetAlpha(rgbs);
}
} else {
for (xii=xi-1; xii<xi+3; xii++) {
const int rgbs = getPixelOverflowPalette(im, xii, yii, bgColor);
kernel = kernel_cache_y * kernel_x[xii-(xi-1)];
new_r += kernel * gdTrueColorGetRed(rgbs);
new_g += kernel * gdTrueColorGetGreen(rgbs);
new_b += kernel * gdTrueColorGetBlue(rgbs);
new_a += kernel * gdTrueColorGetAlpha(rgbs);
}
}
}
new_r = CLAMP(new_r, 0, 255);
new_g = CLAMP(new_g, 0, 255);
new_b = CLAMP(new_b, 0, 255);
new_a = CLAMP(new_a, 0, gdAlphaMax);
return gdTrueColorAlpha(((int)new_r), ((int)new_g), ((int)new_b), ((int)new_a));
}
| 13,811 |
184,473 | 1 | void AutocompleteProvider::AddProviderInfo(
ProvidersInfo* provider_info) const {
}
| 13,812 |
100,577 | 0 | void BrowserTitlebar::UpdateTitleAndIcon() {
if (!app_mode_title_)
return;
string16 title = browser_window_->browser()->GetWindowTitleForCurrentTab();
gtk_label_set_text(GTK_LABEL(app_mode_title_), UTF16ToUTF8(title).c_str());
if (browser_window_->browser()->type() == Browser::TYPE_APP) {
SkBitmap icon = browser_window_->browser()->GetCurrentPageIcon();
if (icon.empty()) {
gtk_util::SetWindowIcon(window_);
} else {
GdkPixbuf* icon_pixbuf = gfx::GdkPixbufFromSkBitmap(&icon);
gtk_window_set_icon(window_, icon_pixbuf);
g_object_unref(icon_pixbuf);
}
}
}
| 13,813 |
185,581 | 1 | void BrowserViewRenderer::DidDestroyCompositor(
content::SynchronousCompositor* compositor) {
TRACE_EVENT0("android_webview", "BrowserViewRenderer::DidDestroyCompositor");
DCHECK(compositor_);
compositor_ = NULL;
}
| 13,814 |
80,648 | 0 | GF_Err url_Size(GF_Box *s)
{
GF_DataEntryURLBox *ptr = (GF_DataEntryURLBox *)s;
if ( !(ptr->flags & 1)) {
if (ptr->location) ptr->size += 1 + strlen(ptr->location);
}
return GF_OK;
}
| 13,815 |
134,001 | 0 | void UpdateSyncItemFromSync(const sync_pb::AppListSpecifics& specifics,
AppListSyncableService::SyncItem* item) {
DCHECK_EQ(item->item_id, specifics.item_id());
item->item_type = specifics.item_type();
item->item_name = specifics.item_name();
item->parent_id = specifics.parent_id();
if (!specifics.item_ordinal().empty())
item->item_ordinal = syncer::StringOrdinal(specifics.item_ordinal());
}
| 13,816 |
148,513 | 0 | void WebContentsImpl::OnUserInteraction(
RenderWidgetHostImpl* render_widget_host,
const blink::WebInputEvent::Type type) {
if (!HasMatchingWidgetHost(&frame_tree_, render_widget_host))
return;
for (auto& observer : observers_)
observer.DidGetUserInteraction(type);
ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
if (rdh && type != blink::WebInputEvent::kMouseWheel)
rdh->OnUserGesture();
}
| 13,817 |
67,826 | 0 | void DefragTrackerClearMemory(DefragTracker *dt)
{
DefragTrackerFreeFrags(dt);
SC_ATOMIC_DESTROY(dt->use_cnt);
}
| 13,818 |
54,960 | 0 | static void add_grep(struct rev_info *revs, const char *ptn, enum grep_pat_token what)
{
append_grep_pattern(&revs->grep_filter, ptn, "command line", 0, what);
}
| 13,819 |
141,573 | 0 | void ForeignSessionHelper::FireForeignSessionCallback() {
if (callback_.is_null())
return;
JNIEnv* env = AttachCurrentThread();
Java_ForeignSessionCallback_onUpdated(env, callback_);
}
| 13,820 |
168,119 | 0 | void ExpectFilledAddressFormElvis(int page_id,
const FormData& filled_form,
int expected_page_id,
bool has_credit_card_fields) {
ExpectFilledForm(page_id, filled_form, expected_page_id, "Elvis", "Aaron",
"Presley", "3734 Elvis Presley Blvd.", "Apt. 10", "Memphis",
"Tennessee", "38116", "United States", "12345678901",
"[email protected]", "", "", "", "", true,
has_credit_card_fields, false);
}
| 13,821 |
187,021 | 1 | ExtensionsGuestViewMessageFilter::FrameNavigationHelper::FrameNavigationHelper(
RenderFrameHost* plugin_rfh,
int32_t guest_instance_id,
int32_t element_instance_id,
bool is_full_page_plugin,
ExtensionsGuestViewMessageFilter* filter)
: content::WebContentsObserver(
content::WebContents::FromRenderFrameHost(plugin_rfh)),
frame_tree_node_id_(plugin_rfh->GetFrameTreeNodeId()),
guest_instance_id_(guest_instance_id),
element_instance_id_(element_instance_id),
is_full_page_plugin_(is_full_page_plugin),
filter_(filter),
parent_site_instance_(plugin_rfh->GetParent()->GetSiteInstance()),
weak_factory_(this) {
DCHECK(GetGuestView());
NavigateToAboutBlank();
base::PostDelayedTaskWithTraits(
FROM_HERE, {BrowserThread::UI},
base::BindOnce(&ExtensionsGuestViewMessageFilter::FrameNavigationHelper::
CancelPendingTask,
weak_factory_.GetWeakPtr()),
base::TimeDelta::FromMilliseconds(kAttachFailureDelayMS));
}
| 13,822 |
112,861 | 0 | void GDataCache::ClearDirtyOnUIThread(const std::string& resource_id,
const std::string& md5,
const CacheOperationCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
base::PlatformFileError* error =
new base::PlatformFileError(base::PLATFORM_FILE_OK);
pool_->GetSequencedTaskRunner(sequence_token_)->PostTaskAndReply(
FROM_HERE,
base::Bind(&GDataCache::ClearDirty,
base::Unretained(this),
resource_id,
md5,
GDataCache::FILE_OPERATION_MOVE,
error),
base::Bind(&RunCacheOperationCallback,
callback,
base::Owned(error),
resource_id,
md5));
}
| 13,823 |
146,408 | 0 | bool WebGLRenderingContextBase::ValidateFramebufferTarget(GLenum target) {
if (target == GL_FRAMEBUFFER)
return true;
return false;
}
| 13,824 |
172,758 | 0 | void h264bsdInitRefPicList(dpbStorage_t *dpb)
{
/* Variables */
u32 i;
/* Code */
for (i = 0; i < dpb->numRefFrames; i++)
dpb->list[i] = &dpb->buffer[i];
}
| 13,825 |
136,834 | 0 | int LocalDOMWindow::screenY() const {
if (!GetFrame())
return 0;
Page* page = GetFrame()->GetPage();
if (!page)
return 0;
ChromeClient& chrome_client = page->GetChromeClient();
if (page->GetSettings().GetReportScreenSizeInPhysicalPixelsQuirk())
return lroundf(chrome_client.RootWindowRect().Y() *
chrome_client.GetScreenInfo().device_scale_factor);
return chrome_client.RootWindowRect().Y();
}
| 13,826 |
34,612 | 0 | static struct sctp_association *__sctp_rcv_asconf_lookup(
sctp_chunkhdr_t *ch,
const union sctp_addr *laddr,
__be16 peer_port,
struct sctp_transport **transportp)
{
sctp_addip_chunk_t *asconf = (struct sctp_addip_chunk *)ch;
struct sctp_af *af;
union sctp_addr_param *param;
union sctp_addr paddr;
/* Skip over the ADDIP header and find the Address parameter */
param = (union sctp_addr_param *)(asconf + 1);
af = sctp_get_af_specific(param_type2af(param->v4.param_hdr.type));
if (unlikely(!af))
return NULL;
af->from_addr_param(&paddr, param, peer_port, 0);
return __sctp_lookup_association(laddr, &paddr, transportp);
}
| 13,827 |
113,657 | 0 | void PPB_URLLoader_Impl::didFail(WebURLLoader* loader,
const WebURLError& error) {
int32_t pp_error = PP_ERROR_FAILED;
if (error.domain.equals(WebString::fromUTF8(net::kErrorDomain))) {
switch (error.reason) {
case net::ERR_ACCESS_DENIED:
case net::ERR_NETWORK_ACCESS_DENIED:
pp_error = PP_ERROR_NOACCESS;
break;
}
} else {
pp_error = PP_ERROR_NOACCESS;
}
FinishLoading(pp_error);
}
| 13,828 |
184,939 | 1 | void HandleCompleteLogin(const base::ListValue* args) {
// TODO(guohui, xiyuan): we should investigate if it is possible to unify
// the signin-with-cookies flow across ChromeOS and Chrome.
#if defined(OS_CHROMEOS)
oauth2_delegate_.reset(new InlineLoginUIOAuth2Delegate(web_ui()));
oauth2_token_fetcher_.reset(new chromeos::OAuth2TokenFetcher(
oauth2_delegate_.get(), profile_->GetRequestContext()));
oauth2_token_fetcher_->StartExchangeFromCookies();
#elif !defined(OS_ANDROID)
const base::DictionaryValue* dict = NULL;
string16 email;
string16 password;
if (!args->GetDictionary(0, &dict) || !dict ||
!dict->GetString("email", &email) ||
!dict->GetString("password", &password)) {
NOTREACHED();
return;
}
// Call OneClickSigninSyncStarter to exchange cookies for oauth tokens.
// OneClickSigninSyncStarter will delete itself once the job is done.
// TODO(guohui): should collect from user whether they want to use
// default sync settings or configure first.
new OneClickSigninSyncStarter(
profile_, NULL, "0" /* session_index 0 for the default user */,
UTF16ToASCII(email), UTF16ToASCII(password),
OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS,
true /* force_same_tab_navigation */,
OneClickSigninSyncStarter::NO_CONFIRMATION);
web_ui()->CallJavascriptFunction("inline.login.closeDialog");
#endif
}
| 13,829 |
93,418 | 0 | static bool netdev_has_any_lower_dev(struct net_device *dev)
{
ASSERT_RTNL();
return !list_empty(&dev->adj_list.lower);
}
| 13,830 |
123,933 | 0 | bool RenderViewImpl::RunJavaScriptMessage(JavaScriptMessageType type,
const string16& message,
const string16& default_value,
const GURL& frame_url,
string16* result) {
bool success = false;
string16 result_temp;
if (!result)
result = &result_temp;
SendAndRunNestedMessageLoop(new ViewHostMsg_RunJavaScriptMessage(
routing_id_, message, default_value, frame_url, type, &success, result));
return success;
}
| 13,831 |
156,285 | 0 | void RendererSchedulerImpl::VirtualTimePaused() {
for (const auto& pair : task_runners_) {
if (pair.first->queue_class() == MainThreadTaskQueue::QueueClass::kTimer) {
DCHECK(!task_queue_throttler_->IsThrottled(pair.first.get()));
DCHECK(!pair.first->HasActiveFence());
pair.first->InsertFence(TaskQueue::InsertFencePosition::kNow);
}
}
for (auto& observer : main_thread_only().virtual_time_observers) {
observer.OnVirtualTimePaused(virtual_time_domain_->Now() -
main_thread_only().initial_virtual_time);
}
}
| 13,832 |
137,689 | 0 | PrintPreviewUI* PrintPreviewMessageHandler::GetPrintPreviewUI() {
WebContents* dialog = GetPrintPreviewDialog();
if (!dialog || !dialog->GetWebUI())
return nullptr;
return static_cast<PrintPreviewUI*>(dialog->GetWebUI()->GetController());
}
| 13,833 |
108,059 | 0 | void GLES2DecoderImpl::DoBufferSubData(
GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) {
BufferManager::BufferInfo* info = GetBufferInfoForTarget(target);
if (!info) {
SetGLError(GL_INVALID_VALUE, "glBufferSubData: unknown buffer");
return;
}
if (!info->SetRange(offset, size, data)) {
SetGLError(GL_INVALID_VALUE, "glBufferSubData: out of range");
} else {
glBufferSubData(target, offset, size, data);
}
}
| 13,834 |
34,114 | 0 | static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
{
struct sockaddr_rc *sa = (struct sockaddr_rc *) addr;
struct sock *sk = sock->sk;
int err = 0;
BT_DBG("sk %p %s", sk, batostr(&sa->rc_bdaddr));
if (!addr || addr->sa_family != AF_BLUETOOTH)
return -EINVAL;
lock_sock(sk);
if (sk->sk_state != BT_OPEN) {
err = -EBADFD;
goto done;
}
if (sk->sk_type != SOCK_STREAM) {
err = -EINVAL;
goto done;
}
write_lock(&rfcomm_sk_list.lock);
if (sa->rc_channel && __rfcomm_get_sock_by_addr(sa->rc_channel, &sa->rc_bdaddr)) {
err = -EADDRINUSE;
} else {
/* Save source address */
bacpy(&bt_sk(sk)->src, &sa->rc_bdaddr);
rfcomm_pi(sk)->channel = sa->rc_channel;
sk->sk_state = BT_BOUND;
}
write_unlock(&rfcomm_sk_list.lock);
done:
release_sock(sk);
return err;
}
| 13,835 |
45,532 | 0 | static int __init crypto_authenc_module_init(void)
{
return crypto_register_template(&crypto_authenc_tmpl);
}
| 13,836 |
37,509 | 0 | static void link_shadow_page(u64 *sptep, struct kvm_mmu_page *sp, bool accessed)
{
u64 spte;
BUILD_BUG_ON(VMX_EPT_READABLE_MASK != PT_PRESENT_MASK ||
VMX_EPT_WRITABLE_MASK != PT_WRITABLE_MASK);
spte = __pa(sp->spt) | PT_PRESENT_MASK | PT_WRITABLE_MASK |
shadow_user_mask | shadow_x_mask;
if (accessed)
spte |= shadow_accessed_mask;
mmu_spte_set(sptep, spte);
}
| 13,837 |
119,755 | 0 | void NavigationControllerImpl::CopyStateFrom(
const NavigationController& temp) {
const NavigationControllerImpl& source =
static_cast<const NavigationControllerImpl&>(temp);
DCHECK(GetEntryCount() == 0 && !GetPendingEntry());
if (source.GetEntryCount() == 0)
return; // Nothing new to do.
needs_reload_ = true;
InsertEntriesFrom(source, source.GetEntryCount());
for (SessionStorageNamespaceMap::const_iterator it =
source.session_storage_namespace_map_.begin();
it != source.session_storage_namespace_map_.end();
++it) {
SessionStorageNamespaceImpl* source_namespace =
static_cast<SessionStorageNamespaceImpl*>(it->second.get());
session_storage_namespace_map_[it->first] = source_namespace->Clone();
}
FinishRestore(source.last_committed_entry_index_, RESTORE_CURRENT_SESSION);
web_contents_->CopyMaxPageIDsFrom(source.web_contents());
}
| 13,838 |
36,810 | 0 | static struct se_device *rd_alloc_device(struct se_hba *hba, const char *name)
{
struct rd_dev *rd_dev;
struct rd_host *rd_host = hba->hba_ptr;
rd_dev = kzalloc(sizeof(struct rd_dev), GFP_KERNEL);
if (!rd_dev) {
pr_err("Unable to allocate memory for struct rd_dev\n");
return NULL;
}
rd_dev->rd_host = rd_host;
return &rd_dev->dev;
}
| 13,839 |
161,810 | 0 | void PlatformSensorProviderLinux::SetSensorDeviceManagerForTesting(
std::unique_ptr<SensorDeviceManager> sensor_device_manager) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
Shutdown();
sensor_device_manager_ = std::move(sensor_device_manager);
}
| 13,840 |
96,309 | 0 | PNET_BUFFER_LIST CNBL::DetachInternalObject()
{
if (IsLSO())
{
m_LsoInfo.LsoV1TransmitComplete.TcpPayload = m_TransferSize;
}
NET_BUFFER_LIST_INFO(m_NBL, TcpLargeSendNetBufferListInfo) = m_LsoInfo.Value;
auto Res = m_NBL;
m_NBL = nullptr;
return Res;
}
| 13,841 |
152,233 | 0 | RenderWidgetFullscreenPepper* RenderFrameImpl::CreatePepperFullscreenContainer(
PepperPluginInstanceImpl* plugin) {
blink::WebURL main_frame_url;
WebFrame* main_frame = render_view()->webview()->MainFrame();
if (main_frame->IsWebLocalFrame())
main_frame_url = main_frame->ToWebLocalFrame()->GetDocument().Url();
mojom::WidgetPtr widget_channel;
mojom::WidgetRequest widget_channel_request =
mojo::MakeRequest(&widget_channel);
int32_t fullscreen_widget_routing_id = MSG_ROUTING_NONE;
if (!RenderThreadImpl::current_render_message_filter()
->CreateFullscreenWidget(render_view()->GetRoutingID(),
std::move(widget_channel),
&fullscreen_widget_routing_id)) {
return nullptr;
}
RenderWidget::ShowCallback show_callback =
base::BindOnce(&RenderViewImpl::ShowCreatedFullscreenWidget,
render_view()->GetWeakPtr());
RenderWidgetFullscreenPepper* widget = RenderWidgetFullscreenPepper::Create(
fullscreen_widget_routing_id, std::move(show_callback),
GetLocalRootRenderWidget()->compositor_deps(), plugin,
std::move(main_frame_url), GetLocalRootRenderWidget()->GetWebScreenInfo(),
std::move(widget_channel_request));
widget->Show(blink::kWebNavigationPolicyCurrentTab);
return widget;
}
| 13,842 |
159,804 | 0 | bool XSSAuditor::FilterLinkToken(const FilterTokenRequest& request) {
DCHECK_EQ(request.token.GetType(), HTMLToken::kStartTag);
DCHECK(HasName(request.token, linkTag));
size_t index_of_attribute = 0;
if (!FindAttributeWithName(request.token, relAttr, index_of_attribute))
return false;
const HTMLToken::Attribute& attribute =
request.token.Attributes().at(index_of_attribute);
LinkRelAttribute parsed_attribute(attribute.Value());
if (!parsed_attribute.IsImport())
return false;
return EraseAttributeIfInjected(request, hrefAttr, kURLWithUniqueOrigin,
kSrcLikeAttributeTruncation,
kAllowSameOriginHref);
}
| 13,843 |
92,850 | 0 | static Bool wgt_enum_dir(void *cbck, char *file_name, char *file_path, GF_FileEnumInfo *file_info)
{
if (!stricmp(file_name, "cvs") || !stricmp(file_name, ".svn") || !stricmp(file_name, ".git")) return 0;
gf_enum_directory(file_path, 0, wgt_enum_files, cbck, NULL);
return gf_enum_directory(file_path, 1, wgt_enum_dir, cbck, NULL);
}
| 13,844 |
8,140 | 0 | void Gfx::opSetDash(Object args[], int numArgs) {
Array *a;
int length;
Object obj;
double *dash;
int i;
a = args[0].getArray();
length = a->getLength();
if (length == 0) {
dash = NULL;
} else {
dash = (double *)gmallocn(length, sizeof(double));
for (i = 0; i < length; ++i) {
dash[i] = a->get(i, &obj)->getNum();
obj.free();
}
}
state->setLineDash(dash, length, args[1].getNum());
out->updateLineDash(state);
}
| 13,845 |
56,585 | 0 | static void ext4_inode_csum_set(struct inode *inode, struct ext4_inode *raw,
struct ext4_inode_info *ei)
{
__u32 csum;
if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
cpu_to_le32(EXT4_OS_LINUX) ||
!ext4_has_metadata_csum(inode->i_sb))
return;
csum = ext4_inode_csum(inode, raw, ei);
raw->i_checksum_lo = cpu_to_le16(csum & 0xFFFF);
if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi))
raw->i_checksum_hi = cpu_to_le16(csum >> 16);
}
| 13,846 |
159,075 | 0 | SafeBrowsingState() {}
| 13,847 |
140,481 | 0 | void TestLoadTimingReused(const net::LoadTimingInfo& load_timing_info) {
EXPECT_TRUE(load_timing_info.socket_reused);
EXPECT_NE(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null());
EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null());
net::ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing);
EXPECT_FALSE(load_timing_info.send_start.is_null());
EXPECT_LE(load_timing_info.send_start, load_timing_info.send_end);
EXPECT_TRUE(load_timing_info.request_start_time.is_null());
EXPECT_TRUE(load_timing_info.request_start.is_null());
EXPECT_TRUE(load_timing_info.receive_headers_end.is_null());
}
| 13,848 |
18,828 | 0 | static int cipso_v4_getattr(const unsigned char *cipso,
struct netlbl_lsm_secattr *secattr)
{
int ret_val = -ENOMSG;
u32 doi;
struct cipso_v4_doi *doi_def;
if (cipso_v4_cache_check(cipso, cipso[1], secattr) == 0)
return 0;
doi = get_unaligned_be32(&cipso[2]);
rcu_read_lock();
doi_def = cipso_v4_doi_search(doi);
if (doi_def == NULL)
goto getattr_return;
/* XXX - This code assumes only one tag per CIPSO option which isn't
* really a good assumption to make but since we only support the MAC
* tags right now it is a safe assumption. */
switch (cipso[6]) {
case CIPSO_V4_TAG_RBITMAP:
ret_val = cipso_v4_parsetag_rbm(doi_def, &cipso[6], secattr);
break;
case CIPSO_V4_TAG_ENUM:
ret_val = cipso_v4_parsetag_enum(doi_def, &cipso[6], secattr);
break;
case CIPSO_V4_TAG_RANGE:
ret_val = cipso_v4_parsetag_rng(doi_def, &cipso[6], secattr);
break;
case CIPSO_V4_TAG_LOCAL:
ret_val = cipso_v4_parsetag_loc(doi_def, &cipso[6], secattr);
break;
}
if (ret_val == 0)
secattr->type = NETLBL_NLTYPE_CIPSOV4;
getattr_return:
rcu_read_unlock();
return ret_val;
}
| 13,849 |
178,755 | 1 | int rds_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
size_t size, int msg_flags)
{
struct sock *sk = sock->sk;
struct rds_sock *rs = rds_sk_to_rs(sk);
long timeo;
int ret = 0, nonblock = msg_flags & MSG_DONTWAIT;
struct sockaddr_in *sin;
struct rds_incoming *inc = NULL;
/* udp_recvmsg()->sock_recvtimeo() gets away without locking too.. */
timeo = sock_rcvtimeo(sk, nonblock);
rdsdebug("size %zu flags 0x%x timeo %ld\n", size, msg_flags, timeo);
if (msg_flags & MSG_OOB)
goto out;
while (1) {
/* If there are pending notifications, do those - and nothing else */
if (!list_empty(&rs->rs_notify_queue)) {
ret = rds_notify_queue_get(rs, msg);
break;
}
if (rs->rs_cong_notify) {
ret = rds_notify_cong(rs, msg);
break;
}
if (!rds_next_incoming(rs, &inc)) {
if (nonblock) {
ret = -EAGAIN;
break;
}
timeo = wait_event_interruptible_timeout(*sk_sleep(sk),
(!list_empty(&rs->rs_notify_queue) ||
rs->rs_cong_notify ||
rds_next_incoming(rs, &inc)), timeo);
rdsdebug("recvmsg woke inc %p timeo %ld\n", inc,
timeo);
if (timeo > 0 || timeo == MAX_SCHEDULE_TIMEOUT)
continue;
ret = timeo;
if (ret == 0)
ret = -ETIMEDOUT;
break;
}
rdsdebug("copying inc %p from %pI4:%u to user\n", inc,
&inc->i_conn->c_faddr,
ntohs(inc->i_hdr.h_sport));
ret = inc->i_conn->c_trans->inc_copy_to_user(inc, msg->msg_iov,
size);
if (ret < 0)
break;
/*
* if the message we just copied isn't at the head of the
* recv queue then someone else raced us to return it, try
* to get the next message.
*/
if (!rds_still_queued(rs, inc, !(msg_flags & MSG_PEEK))) {
rds_inc_put(inc);
inc = NULL;
rds_stats_inc(s_recv_deliver_raced);
continue;
}
if (ret < be32_to_cpu(inc->i_hdr.h_len)) {
if (msg_flags & MSG_TRUNC)
ret = be32_to_cpu(inc->i_hdr.h_len);
msg->msg_flags |= MSG_TRUNC;
}
if (rds_cmsg_recv(inc, msg)) {
ret = -EFAULT;
goto out;
}
rds_stats_inc(s_recv_delivered);
sin = (struct sockaddr_in *)msg->msg_name;
if (sin) {
sin->sin_family = AF_INET;
sin->sin_port = inc->i_hdr.h_sport;
sin->sin_addr.s_addr = inc->i_saddr;
memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
}
break;
}
if (inc)
rds_inc_put(inc);
out:
return ret;
}
| 13,850 |
76,525 | 0 | int kvm_arm_vcpu_arch_has_attr(struct kvm_vcpu *vcpu,
struct kvm_device_attr *attr)
{
int ret;
switch (attr->group) {
case KVM_ARM_VCPU_PMU_V3_CTRL:
ret = kvm_arm_pmu_v3_has_attr(vcpu, attr);
break;
case KVM_ARM_VCPU_TIMER_CTRL:
ret = kvm_arm_timer_has_attr(vcpu, attr);
break;
default:
ret = -ENXIO;
break;
}
return ret;
}
| 13,851 |
178,902 | 1 | static void tun_net_init(struct net_device *dev)
{
struct tun_struct *tun = netdev_priv(dev);
switch (tun->flags & TUN_TYPE_MASK) {
case TUN_TUN_DEV:
dev->netdev_ops = &tun_netdev_ops;
/* Point-to-Point TUN Device */
dev->hard_header_len = 0;
dev->addr_len = 0;
dev->mtu = 1500;
/* Zero header length */
dev->type = ARPHRD_NONE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */
break;
case TUN_TAP_DEV:
dev->netdev_ops = &tap_netdev_ops;
/* Ethernet TAP Device */
ether_setup(dev);
random_ether_addr(dev->dev_addr);
dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */
break;
}
}
| 13,852 |
100,131 | 0 | void BrowserActionsContainer::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterIntegerPref(prefs::kBrowserActionContainerWidth, 0);
}
| 13,853 |
113,975 | 0 | virtual ~FakeInvalidationClient() {}
| 13,854 |
135,105 | 0 | void AppCacheDispatcherHost::OnGetStatus(int host_id, IPC::Message* reply_msg) {
if (pending_reply_msg_) {
bad_message::ReceivedBadMessage(
this, bad_message::ACDH_PENDING_REPLY_IN_GET_STATUS);
delete reply_msg;
return;
}
pending_reply_msg_.reset(reply_msg);
if (appcache_service_.get()) {
if (!backend_impl_.GetStatusWithCallback(
host_id, get_status_callback_, reply_msg)) {
bad_message::ReceivedBadMessage(this, bad_message::ACDH_GET_STATUS);
}
return;
}
GetStatusCallback(APPCACHE_STATUS_UNCACHED, reply_msg);
}
| 13,855 |
165,373 | 0 | void ClearedShaderCache(base::OnceClosure callback) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::UI},
base::BindOnce(&ClearedShaderCache, std::move(callback)));
return;
}
std::move(callback).Run();
}
| 13,856 |
25,657 | 0 | static void perf_stop_nmi_watchdog(void *unused)
{
struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
stop_nmi_watchdog(NULL);
cpuc->pcr = pcr_ops->read();
}
| 13,857 |
64,983 | 0 | IW_IMPL(void) iw_set_apply_bkgd_2(struct iw_context *ctx, const struct iw_color *clr)
{
ctx->req.bkgd_valid=1;
ctx->req.bkgd = *clr;
}
| 13,858 |
3,398 | 0 | hook_command_build_completion (struct t_hook_command *hook_command)
{
int i, j, k, length, num_items;
struct t_weelist *list;
char *pos_completion, *pos_double_pipe, *pos_start, *pos_end;
char **items, *last_space, *ptr_template;
/* split templates using "||" as separator */
hook_command->cplt_num_templates = 1;
pos_completion = hook_command->completion;
while ((pos_double_pipe = strstr (pos_completion, "||")) != NULL)
{
hook_command->cplt_num_templates++;
pos_completion = pos_double_pipe + 2;
}
hook_command->cplt_templates = malloc (hook_command->cplt_num_templates *
sizeof (*hook_command->cplt_templates));
for (i = 0; i < hook_command->cplt_num_templates; i++)
{
hook_command->cplt_templates[i] = NULL;
}
pos_completion = hook_command->completion;
i = 0;
while (pos_completion)
{
pos_double_pipe = strstr (pos_completion, "||");
if (!pos_double_pipe)
pos_double_pipe = pos_completion + strlen (pos_completion);
pos_start = pos_completion;
pos_end = pos_double_pipe - 1;
if (pos_end < pos_start)
{
hook_command->cplt_templates[i] = strdup ("");
}
else
{
while (pos_start[0] == ' ')
{
pos_start++;
}
pos_end = pos_double_pipe - 1;
while ((pos_end > pos_start) && (pos_end[0] == ' '))
{
pos_end--;
}
hook_command->cplt_templates[i] = string_strndup (pos_start,
pos_end - pos_start + 1);
}
i++;
if (!pos_double_pipe[0])
pos_completion = NULL;
else
pos_completion = pos_double_pipe + 2;
}
/* for each template, split/count args */
hook_command->cplt_templates_static = malloc (hook_command->cplt_num_templates *
sizeof (*hook_command->cplt_templates_static));
hook_command->cplt_template_num_args = malloc (hook_command->cplt_num_templates *
sizeof (*hook_command->cplt_template_num_args));
hook_command->cplt_template_args = malloc (hook_command->cplt_num_templates *
sizeof (*hook_command->cplt_template_args));
hook_command->cplt_template_num_args_concat = 0;
for (i = 0; i < hook_command->cplt_num_templates; i++)
{
/*
* build static part of template: it's first argument(s) which does not
* contain "%" or "|"
*/
last_space = NULL;
ptr_template = hook_command->cplt_templates[i];
while (ptr_template && ptr_template[0])
{
if (ptr_template[0] == ' ')
last_space = ptr_template;
else if ((ptr_template[0] == '%') || (ptr_template[0] == '|'))
break;
ptr_template = utf8_next_char (ptr_template);
}
if (last_space)
{
last_space--;
while (last_space > hook_command->cplt_templates[i])
{
if (last_space[0] != ' ')
break;
}
if (last_space < hook_command->cplt_templates[i])
last_space = NULL;
else
last_space++;
}
if (last_space)
hook_command->cplt_templates_static[i] = string_strndup (hook_command->cplt_templates[i],
last_space - hook_command->cplt_templates[i]);
else
hook_command->cplt_templates_static[i] = strdup (hook_command->cplt_templates[i]);
/* build arguments for each template */
hook_command->cplt_template_args[i] = string_split (hook_command->cplt_templates[i],
" ", 0, 0,
&(hook_command->cplt_template_num_args[i]));
if (hook_command->cplt_template_num_args[i] > hook_command->cplt_template_num_args_concat)
hook_command->cplt_template_num_args_concat = hook_command->cplt_template_num_args[i];
}
/*
* build strings with concatentaion of items from different templates
* for each argument: these strings will be used when completing argument
* if we can't find which template to use (for example for first argument)
*/
if (hook_command->cplt_template_num_args_concat == 0)
hook_command->cplt_template_args_concat = NULL;
else
{
hook_command->cplt_template_args_concat = malloc (hook_command->cplt_template_num_args_concat *
sizeof (*hook_command->cplt_template_args_concat));
list = weelist_new ();
for (i = 0; i < hook_command->cplt_template_num_args_concat; i++)
{
/* first compute length */
length = 1;
for (j = 0; j < hook_command->cplt_num_templates; j++)
{
if (i < hook_command->cplt_template_num_args[j])
length += strlen (hook_command->cplt_template_args[j][i]) + 1;
}
/* alloc memory */
hook_command->cplt_template_args_concat[i] = malloc (length);
if (hook_command->cplt_template_args_concat[i])
{
/* concatene items with "|" as separator */
weelist_remove_all (list);
hook_command->cplt_template_args_concat[i][0] = '\0';
for (j = 0; j < hook_command->cplt_num_templates; j++)
{
if (i < hook_command->cplt_template_num_args[j])
{
items = string_split (hook_command->cplt_template_args[j][i],
"|", 0, 0, &num_items);
for (k = 0; k < num_items; k++)
{
if (!weelist_search (list, items[k]))
{
if (hook_command->cplt_template_args_concat[i][0])
strcat (hook_command->cplt_template_args_concat[i], "|");
strcat (hook_command->cplt_template_args_concat[i],
items[k]);
weelist_add (list, items[k], WEECHAT_LIST_POS_END,
NULL);
}
}
string_free_split (items);
}
}
}
}
weelist_free (list);
}
}
| 13,859 |
69,165 | 0 | ZEND_API void zend_hash_bucket_packed_swap(Bucket *p, Bucket *q)
{
zval val;
zend_ulong h;
ZVAL_COPY_VALUE(&val, &p->val);
h = p->h;
ZVAL_COPY_VALUE(&p->val, &q->val);
p->h = q->h;
ZVAL_COPY_VALUE(&q->val, &val);
q->h = h;
}
| 13,860 |
85,427 | 0 | static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del)
{
struct seg_entry *se;
unsigned int segno, offset;
long int new_vblocks;
segno = GET_SEGNO(sbi, blkaddr);
se = get_seg_entry(sbi, segno);
new_vblocks = se->valid_blocks + del;
offset = GET_BLKOFF_FROM_SEG0(sbi, blkaddr);
f2fs_bug_on(sbi, (new_vblocks >> (sizeof(unsigned short) << 3) ||
(new_vblocks > sbi->blocks_per_seg)));
se->valid_blocks = new_vblocks;
se->mtime = get_mtime(sbi);
SIT_I(sbi)->max_mtime = se->mtime;
/* Update valid block bitmap */
if (del > 0) {
if (f2fs_test_and_set_bit(offset, se->cur_valid_map)) {
#ifdef CONFIG_F2FS_CHECK_FS
if (f2fs_test_and_set_bit(offset,
se->cur_valid_map_mir))
f2fs_bug_on(sbi, 1);
else
WARN_ON(1);
#else
f2fs_bug_on(sbi, 1);
#endif
}
if (f2fs_discard_en(sbi) &&
!f2fs_test_and_set_bit(offset, se->discard_map))
sbi->discard_blks--;
/* don't overwrite by SSR to keep node chain */
if (se->type == CURSEG_WARM_NODE) {
if (!f2fs_test_and_set_bit(offset, se->ckpt_valid_map))
se->ckpt_valid_blocks++;
}
} else {
if (!f2fs_test_and_clear_bit(offset, se->cur_valid_map)) {
#ifdef CONFIG_F2FS_CHECK_FS
if (!f2fs_test_and_clear_bit(offset,
se->cur_valid_map_mir))
f2fs_bug_on(sbi, 1);
else
WARN_ON(1);
#else
f2fs_bug_on(sbi, 1);
#endif
}
if (f2fs_discard_en(sbi) &&
f2fs_test_and_clear_bit(offset, se->discard_map))
sbi->discard_blks++;
}
if (!f2fs_test_bit(offset, se->ckpt_valid_map))
se->ckpt_valid_blocks += del;
__mark_sit_entry_dirty(sbi, segno);
/* update total number of valid blocks to be written in ckpt area */
SIT_I(sbi)->written_valid_blocks += del;
if (sbi->segs_per_sec > 1)
get_sec_entry(sbi, segno)->valid_blocks += del;
}
| 13,861 |
174,270 | 0 | status_t Camera3Device::setNotifyCallback(NotificationListener *listener) {
ATRACE_CALL();
Mutex::Autolock l(mOutputLock);
if (listener != NULL && mListener != NULL) {
ALOGW("%s: Replacing old callback listener", __FUNCTION__);
}
mListener = listener;
mRequestThread->setNotificationListener(listener);
mPreparerThread->setNotificationListener(listener);
return OK;
}
| 13,862 |
100,027 | 0 | NPObject* WebPluginImpl::scriptableObject() {
return delegate_->GetPluginScriptableObject();
}
| 13,863 |
46,672 | 0 | static int need_fallback(unsigned int key_len)
{
switch (key_len) {
case 16:
if (!(keylen_flag & AES_KEYLEN_128))
return 1;
break;
case 24:
if (!(keylen_flag & AES_KEYLEN_192))
return 1;
break;
case 32:
if (!(keylen_flag & AES_KEYLEN_256))
return 1;
break;
default:
return -1;
break;
}
return 0;
}
| 13,864 |
93,809 | 0 | virDomainGetJobInfo(virDomainPtr domain, virDomainJobInfoPtr info)
{
virConnectPtr conn;
VIR_DOMAIN_DEBUG(domain, "info=%p", info);
virResetLastError();
if (info)
memset(info, 0, sizeof(*info));
virCheckDomainReturn(domain, -1);
virCheckNonNullArgGoto(info, error);
conn = domain->conn;
if (conn->driver->domainGetJobInfo) {
int ret;
ret = conn->driver->domainGetJobInfo(domain, info);
if (ret < 0)
goto error;
return ret;
}
virReportUnsupportedError();
error:
virDispatchError(domain->conn);
return -1;
}
| 13,865 |
120,616 | 0 | void Element::scheduleSyntheticStyleChange()
{
if (postAttachCallbacksAreSuspended())
queuePostAttachCallback(needsSyntheticStyleChangeCallback, this);
else
setNeedsStyleRecalc(SyntheticStyleChange);
}
| 13,866 |
159,415 | 0 | ExtensionsAPIClient::CreateVirtualKeyboardDelegate(
content::BrowserContext* context) const {
return nullptr;
}
| 13,867 |
93,601 | 0 | static void __exit nvmet_fc_exit_module(void)
{
/* sanity check - all lports should be removed */
if (!list_empty(&nvmet_fc_target_list))
pr_warn("%s: targetport list not empty\n", __func__);
nvmet_unregister_transport(&nvmet_fc_tgt_fcp_ops);
ida_destroy(&nvmet_fc_tgtport_cnt);
}
| 13,868 |
30,702 | 0 | void sco_connect_cfm(struct hci_conn *hcon, __u8 status)
{
BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status);
if (!status) {
struct sco_conn *conn;
conn = sco_conn_add(hcon);
if (conn)
sco_conn_ready(conn);
} else
sco_conn_del(hcon, bt_to_errno(status));
}
| 13,869 |
148,855 | 0 | void RenderFrameHostManager::CommitPending() {
TRACE_EVENT1("navigation", "RenderFrameHostManager::CommitPending",
"FrameTreeNode id", frame_tree_node_->frame_tree_node_id());
DCHECK(pending_render_frame_host_ || speculative_render_frame_host_);
bool is_main_frame = frame_tree_node_->IsMainFrame();
bool will_focus_location_bar =
is_main_frame && delegate_->FocusLocationBarByDefault();
bool focus_render_view = !will_focus_location_bar &&
render_frame_host_->GetView() &&
render_frame_host_->GetView()->HasFocus();
frame_tree_node_->ResetForNewProcess();
std::unique_ptr<RenderFrameHostImpl> old_render_frame_host;
if (!IsBrowserSideNavigationEnabled()) {
DCHECK(!speculative_render_frame_host_);
old_render_frame_host =
SetRenderFrameHost(std::move(pending_render_frame_host_));
} else {
DCHECK(speculative_render_frame_host_);
old_render_frame_host =
SetRenderFrameHost(std::move(speculative_render_frame_host_));
}
SkColor old_background_color = SK_ColorWHITE;
bool has_old_background_color = false;
if (old_render_frame_host->GetView()) {
has_old_background_color = true;
old_background_color = old_render_frame_host->GetView()->background_color();
}
bool new_rfh_has_view = !!render_frame_host_->GetView();
if (!delegate_->IsHidden() && new_rfh_has_view) {
render_frame_host_->GetView()->Show();
}
render_frame_host_->GetProcess()->RemovePendingView();
if (!new_rfh_has_view) {
DCHECK(!render_frame_host_->IsRenderFrameLive());
DCHECK(!render_frame_host_->render_view_host()->IsRenderViewLive());
render_frame_host_->ResetLoadingState();
delegate_->RenderProcessGoneFromRenderManager(
render_frame_host_->render_view_host());
}
if (is_main_frame &&
old_render_frame_host->render_view_host()->GetWidget()->GetView()) {
old_render_frame_host->render_view_host()->GetWidget()->GetView()->Hide();
}
delegate_->UpdateRenderViewSizeForRenderManager();
if (will_focus_location_bar) {
delegate_->SetFocusToLocationBar(false);
} else if (focus_render_view && render_frame_host_->GetView()) {
if (is_main_frame) {
render_frame_host_->GetView()->Focus();
} else {
frame_tree_node_->frame_tree()->SetPageFocus(
render_frame_host_->GetSiteInstance(), true);
}
}
delegate_->NotifySwappedFromRenderManager(
old_render_frame_host.get(), render_frame_host_.get(), is_main_frame);
if (has_old_background_color && render_frame_host_->GetView())
render_frame_host_->GetView()->SetBackgroundColor(old_background_color);
if (is_main_frame) {
RenderViewHostImpl* rvh = render_frame_host_->render_view_host();
rvh->set_main_frame_routing_id(render_frame_host_->routing_id());
if (!rvh->is_active())
rvh->PostRenderViewReady();
rvh->set_is_active(true);
rvh->set_is_swapped_out(false);
old_render_frame_host->render_view_host()->set_main_frame_routing_id(
MSG_ROUTING_NONE);
}
SwapOutOldFrame(std::move(old_render_frame_host));
DeleteRenderFrameProxyHost(render_frame_host_->GetSiteInstance());
RenderFrameProxyHost* proxy_to_parent = GetProxyToParent();
if (proxy_to_parent) {
CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
proxy_to_parent->SetChildRWHView(render_frame_host_->GetView());
}
CHECK(!GetRenderFrameProxyHost(render_frame_host_->GetSiteInstance()));
}
| 13,870 |
160,144 | 0 | EntryImpl* LeakEntryImpl(scoped_refptr<EntryImpl> entry) {
if (entry)
entry->AddRef();
return entry.get();
}
| 13,871 |
65,155 | 0 | static void __net_exit tcpv6_net_exit_batch(struct list_head *net_exit_list)
{
inet_twsk_purge(&tcp_hashinfo, AF_INET6);
}
| 13,872 |
152,020 | 0 | void RenderFrameHostImpl::OnContextMenu(const ContextMenuParams& params) {
if (!is_active())
return;
ContextMenuParams validated_params(params);
RenderProcessHost* process = GetProcess();
process->FilterURL(true, &validated_params.link_url);
process->FilterURL(true, &validated_params.src_url);
process->FilterURL(false, &validated_params.page_url);
process->FilterURL(true, &validated_params.frame_url);
gfx::Point original_point(validated_params.x, validated_params.y);
gfx::Point transformed_point =
static_cast<RenderWidgetHostViewBase*>(GetView())
->TransformPointToRootCoordSpace(original_point);
validated_params.x = transformed_point.x();
validated_params.y = transformed_point.y();
if (validated_params.selection_start_offset < 0) {
bad_message::ReceivedBadMessage(
GetProcess(), bad_message::RFH_NEGATIVE_SELECTION_START_OFFSET);
}
delegate_->ShowContextMenu(this, validated_params);
}
| 13,873 |
3,346 | 0 | static void fdctrl_write (void *opaque, uint32_t reg, uint32_t value)
{
FDCtrl *fdctrl = opaque;
FLOPPY_DPRINTF("write reg%d: 0x%02x\n", reg & 7, value);
reg &= 7;
switch (reg) {
case FD_REG_DOR:
fdctrl_write_dor(fdctrl, value);
break;
case FD_REG_TDR:
fdctrl_write_tape(fdctrl, value);
break;
case FD_REG_DSR:
fdctrl_write_rate(fdctrl, value);
break;
case FD_REG_FIFO:
fdctrl_write_data(fdctrl, value);
break;
case FD_REG_CCR:
fdctrl_write_ccr(fdctrl, value);
break;
default:
break;
}
}
| 13,874 |
75,497 | 0 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
{
struct usb_device *hdev = hub->hdev;
struct usb_hcd *hcd;
int ret;
int port1;
int status;
bool need_debounce_delay = false;
unsigned delay;
/* Continue a partial initialization */
if (type == HUB_INIT2 || type == HUB_INIT3) {
device_lock(&hdev->dev);
/* Was the hub disconnected while we were waiting? */
if (hub->disconnected)
goto disconnected;
if (type == HUB_INIT2)
goto init2;
goto init3;
}
kref_get(&hub->kref);
/* The superspeed hub except for root hub has to use Hub Depth
* value as an offset into the route string to locate the bits
* it uses to determine the downstream port number. So hub driver
* should send a set hub depth request to superspeed hub after
* the superspeed hub is set configuration in initialization or
* reset procedure.
*
* After a resume, port power should still be on.
* For any other type of activation, turn it on.
*/
if (type != HUB_RESUME) {
if (hdev->parent && hub_is_superspeed(hdev)) {
ret = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
HUB_SET_DEPTH, USB_RT_HUB,
hdev->level - 1, 0, NULL, 0,
USB_CTRL_SET_TIMEOUT);
if (ret < 0)
dev_err(hub->intfdev,
"set hub depth failed\n");
}
/* Speed up system boot by using a delayed_work for the
* hub's initial power-up delays. This is pretty awkward
* and the implementation looks like a home-brewed sort of
* setjmp/longjmp, but it saves at least 100 ms for each
* root hub (assuming usbcore is compiled into the kernel
* rather than as a module). It adds up.
*
* This can't be done for HUB_RESUME or HUB_RESET_RESUME
* because for those activation types the ports have to be
* operational when we return. In theory this could be done
* for HUB_POST_RESET, but it's easier not to.
*/
if (type == HUB_INIT) {
delay = hub_power_on_good_delay(hub);
hub_power_on(hub, false);
INIT_DELAYED_WORK(&hub->init_work, hub_init_func2);
queue_delayed_work(system_power_efficient_wq,
&hub->init_work,
msecs_to_jiffies(delay));
/* Suppress autosuspend until init is done */
usb_autopm_get_interface_no_resume(
to_usb_interface(hub->intfdev));
return; /* Continues at init2: below */
} else if (type == HUB_RESET_RESUME) {
/* The internal host controller state for the hub device
* may be gone after a host power loss on system resume.
* Update the device's info so the HW knows it's a hub.
*/
hcd = bus_to_hcd(hdev->bus);
if (hcd->driver->update_hub_device) {
ret = hcd->driver->update_hub_device(hcd, hdev,
&hub->tt, GFP_NOIO);
if (ret < 0) {
dev_err(hub->intfdev,
"Host not accepting hub info update\n");
dev_err(hub->intfdev,
"LS/FS devices and hubs may not work under this hub\n");
}
}
hub_power_on(hub, true);
} else {
hub_power_on(hub, true);
}
}
init2:
/*
* Check each port and set hub->change_bits to let hub_wq know
* which ports need attention.
*/
for (port1 = 1; port1 <= hdev->maxchild; ++port1) {
struct usb_port *port_dev = hub->ports[port1 - 1];
struct usb_device *udev = port_dev->child;
u16 portstatus, portchange;
portstatus = portchange = 0;
status = hub_port_status(hub, port1, &portstatus, &portchange);
if (status)
goto abort;
if (udev || (portstatus & USB_PORT_STAT_CONNECTION))
dev_dbg(&port_dev->dev, "status %04x change %04x\n",
portstatus, portchange);
/*
* After anything other than HUB_RESUME (i.e., initialization
* or any sort of reset), every port should be disabled.
* Unconnected ports should likewise be disabled (paranoia),
* and so should ports for which we have no usb_device.
*/
if ((portstatus & USB_PORT_STAT_ENABLE) && (
type != HUB_RESUME ||
!(portstatus & USB_PORT_STAT_CONNECTION) ||
!udev ||
udev->state == USB_STATE_NOTATTACHED)) {
/*
* USB3 protocol ports will automatically transition
* to Enabled state when detect an USB3.0 device attach.
* Do not disable USB3 protocol ports, just pretend
* power was lost
*/
portstatus &= ~USB_PORT_STAT_ENABLE;
if (!hub_is_superspeed(hdev))
usb_clear_port_feature(hdev, port1,
USB_PORT_FEAT_ENABLE);
}
/* Clear status-change flags; we'll debounce later */
if (portchange & USB_PORT_STAT_C_CONNECTION) {
need_debounce_delay = true;
usb_clear_port_feature(hub->hdev, port1,
USB_PORT_FEAT_C_CONNECTION);
}
if (portchange & USB_PORT_STAT_C_ENABLE) {
need_debounce_delay = true;
usb_clear_port_feature(hub->hdev, port1,
USB_PORT_FEAT_C_ENABLE);
}
if (portchange & USB_PORT_STAT_C_RESET) {
need_debounce_delay = true;
usb_clear_port_feature(hub->hdev, port1,
USB_PORT_FEAT_C_RESET);
}
if ((portchange & USB_PORT_STAT_C_BH_RESET) &&
hub_is_superspeed(hub->hdev)) {
need_debounce_delay = true;
usb_clear_port_feature(hub->hdev, port1,
USB_PORT_FEAT_C_BH_PORT_RESET);
}
/* We can forget about a "removed" device when there's a
* physical disconnect or the connect status changes.
*/
if (!(portstatus & USB_PORT_STAT_CONNECTION) ||
(portchange & USB_PORT_STAT_C_CONNECTION))
clear_bit(port1, hub->removed_bits);
if (!udev || udev->state == USB_STATE_NOTATTACHED) {
/* Tell hub_wq to disconnect the device or
* check for a new connection or over current condition.
* Based on USB2.0 Spec Section 11.12.5,
* C_PORT_OVER_CURRENT could be set while
* PORT_OVER_CURRENT is not. So check for any of them.
*/
if (udev || (portstatus & USB_PORT_STAT_CONNECTION) ||
(portstatus & USB_PORT_STAT_OVERCURRENT) ||
(portchange & USB_PORT_STAT_C_OVERCURRENT))
set_bit(port1, hub->change_bits);
} else if (portstatus & USB_PORT_STAT_ENABLE) {
bool port_resumed = (portstatus &
USB_PORT_STAT_LINK_STATE) ==
USB_SS_PORT_LS_U0;
/* The power session apparently survived the resume.
* If there was an overcurrent or suspend change
* (i.e., remote wakeup request), have hub_wq
* take care of it. Look at the port link state
* for USB 3.0 hubs, since they don't have a suspend
* change bit, and they don't set the port link change
* bit on device-initiated resume.
*/
if (portchange || (hub_is_superspeed(hub->hdev) &&
port_resumed))
set_bit(port1, hub->change_bits);
} else if (udev->persist_enabled) {
#ifdef CONFIG_PM
udev->reset_resume = 1;
#endif
/* Don't set the change_bits when the device
* was powered off.
*/
if (test_bit(port1, hub->power_bits))
set_bit(port1, hub->change_bits);
} else {
/* The power session is gone; tell hub_wq */
usb_set_device_state(udev, USB_STATE_NOTATTACHED);
set_bit(port1, hub->change_bits);
}
}
/* If no port-status-change flags were set, we don't need any
* debouncing. If flags were set we can try to debounce the
* ports all at once right now, instead of letting hub_wq do them
* one at a time later on.
*
* If any port-status changes do occur during this delay, hub_wq
* will see them later and handle them normally.
*/
if (need_debounce_delay) {
delay = HUB_DEBOUNCE_STABLE;
/* Don't do a long sleep inside a workqueue routine */
if (type == HUB_INIT2) {
INIT_DELAYED_WORK(&hub->init_work, hub_init_func3);
queue_delayed_work(system_power_efficient_wq,
&hub->init_work,
msecs_to_jiffies(delay));
device_unlock(&hdev->dev);
return; /* Continues at init3: below */
} else {
msleep(delay);
}
}
init3:
hub->quiescing = 0;
status = usb_submit_urb(hub->urb, GFP_NOIO);
if (status < 0)
dev_err(hub->intfdev, "activate --> %d\n", status);
if (hub->has_indicators && blinkenlights)
queue_delayed_work(system_power_efficient_wq,
&hub->leds, LED_CYCLE_PERIOD);
/* Scan all ports that need attention */
kick_hub_wq(hub);
abort:
if (type == HUB_INIT2 || type == HUB_INIT3) {
/* Allow autosuspend if it was suppressed */
disconnected:
usb_autopm_put_interface_async(to_usb_interface(hub->intfdev));
device_unlock(&hdev->dev);
}
kref_put(&hub->kref, hub_release);
}
| 13,875 |
163,232 | 0 | TestDeferringNavigationThrottleInstaller(
WebContents* web_contents,
NavigationThrottle::ThrottleCheckResult will_start_result,
NavigationThrottle::ThrottleCheckResult will_redirect_result,
NavigationThrottle::ThrottleCheckResult will_fail_result,
NavigationThrottle::ThrottleCheckResult will_process_result,
GURL expected_start_url = GURL())
: TestNavigationThrottleInstaller(web_contents,
NavigationThrottle::DEFER,
NavigationThrottle::DEFER,
NavigationThrottle::DEFER,
NavigationThrottle::DEFER,
expected_start_url),
will_start_deferred_result_(will_start_result),
will_redirect_deferred_result_(will_redirect_result),
will_fail_deferred_result_(will_fail_result),
will_process_deferred_result_(will_process_result) {}
| 13,876 |
33,904 | 0 | gio_poll_dispatch_del(int32_t fd)
{
struct gio_to_qb_poll *adaptor;
crm_trace("Looking for fd=%d", fd);
if (qb_array_index(gio_map, fd, (void**)&adaptor) == 0) {
crm_trace("Marking adaptor %p unused (ref=%d)", adaptor, gio_adapter_refcount(adaptor));
adaptor->is_used = QB_FALSE;
}
return 0;
}
| 13,877 |
127,661 | 0 | TransportDIB::TransportDIB()
: address_(kInvalidAddress),
x_shm_(0),
display_(NULL),
size_(0) {
}
| 13,878 |
126,767 | 0 | int BrowserView::GetExtraRenderViewHeight() const {
return 0;
}
| 13,879 |
87,853 | 0 | callout_tag_entry_raw(CalloutTagTable* t, UChar* name, UChar* name_end,
CalloutTagVal entry_val)
{
int r;
CalloutTagVal val;
if (name_end - name <= 0)
return ONIGERR_INVALID_CALLOUT_TAG_NAME;
val = callout_tag_find(t, name, name_end);
if (val >= 0)
return ONIGERR_MULTIPLEX_DEFINED_NAME;
r = onig_st_insert_strend(t, name, name_end, (HashDataType )entry_val);
if (r < 0) return r;
return ONIG_NORMAL;
}
| 13,880 |
89,510 | 0 | SWFRect SWFShape_getEdgeBounds(SWFShape shape)
{
if(shape->useVersion == SWF_SHAPE4)
return shape->edgeBounds;
else
return NULL;
}
| 13,881 |
116,379 | 0 | ~FastTransactionServer() {}
| 13,882 |
115,020 | 0 | void TestingAutomationProvider::SendOSLevelKeyEventToTab(
DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
int modifiers, keycode;
if (!args->GetInteger("keyCode", &keycode)) {
AutomationJSONReply(this, reply_message)
.SendError("'keyCode' missing or invalid.");
return;
}
if (!args->GetInteger("modifiers", &modifiers)) {
AutomationJSONReply(this, reply_message)
.SendError("'modifiers' missing or invalid.");
return;
}
std::string error;
Browser* browser;
WebContents* web_contents;
if (!GetBrowserAndTabFromJSONArgs(args, &browser, &web_contents, &error)) {
AutomationJSONReply(this, reply_message).SendError(error);
return;
}
browser->ActivateTabAt(
browser->GetIndexOfController(&web_contents->GetController()), true);
BrowserWindow* browser_window = browser->window();
if (!browser_window) {
AutomationJSONReply(this, reply_message)
.SendError("Could not get the browser window");
return;
}
gfx::NativeWindow window = browser_window->GetNativeHandle();
if (!window) {
AutomationJSONReply(this, reply_message)
.SendError("Could not get the browser window handle");
return;
}
bool control = !!(modifiers & automation::kControlKeyMask);
bool shift = !!(modifiers & automation::kShiftKeyMask);
bool alt = !!(modifiers & automation::kAltKeyMask);
bool meta = !!(modifiers & automation::kMetaKeyMask);
if (!ui_controls::SendKeyPressNotifyWhenDone(
window, static_cast<ui::KeyboardCode>(keycode),
control, shift, alt, meta,
base::Bind(&TestingAutomationProvider::SendSuccessReply, this,
reply_message))) {
AutomationJSONReply(this, reply_message)
.SendError("Could not send the native key event");
}
}
| 13,883 |
13,167 | 0 | xps_parse_real_num(char *s, float *number)
{
char buf[64];
char *p = buf;
while (is_real_num_char(*s))
*p++ = *s++;
*p = 0;
if (buf[0])
*number = fz_atof(buf);
return s;
}
| 13,884 |
25,033 | 0 | static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
{
struct {
cycles_t cycles;
long jiffies;
unsigned num;
} sample;
long delta, delta2, delta3;
preempt_disable();
/* if over the trickle threshold, use only 1 in 4096 samples */
if (input_pool.entropy_count > trickle_thresh &&
((__this_cpu_inc_return(trickle_count) - 1) & 0xfff))
goto out;
sample.jiffies = jiffies;
sample.cycles = get_cycles();
sample.num = num;
mix_pool_bytes(&input_pool, &sample, sizeof(sample));
/*
* Calculate number of bits of randomness we probably added.
* We take into account the first, second and third-order deltas
* in order to make our estimate.
*/
if (!state->dont_count_entropy) {
delta = sample.jiffies - state->last_time;
state->last_time = sample.jiffies;
delta2 = delta - state->last_delta;
state->last_delta = delta;
delta3 = delta2 - state->last_delta2;
state->last_delta2 = delta2;
if (delta < 0)
delta = -delta;
if (delta2 < 0)
delta2 = -delta2;
if (delta3 < 0)
delta3 = -delta3;
if (delta > delta2)
delta = delta2;
if (delta > delta3)
delta = delta3;
/*
* delta is now minimum absolute delta.
* Round down by 1 bit on general principles,
* and limit entropy entimate to 12 bits.
*/
credit_entropy_bits(&input_pool,
min_t(int, fls(delta>>1), 11));
}
out:
preempt_enable();
}
| 13,885 |
72,568 | 0 | static bool rb_per_cpu_empty(struct ring_buffer_per_cpu *cpu_buffer)
{
struct buffer_page *reader = cpu_buffer->reader_page;
struct buffer_page *head = rb_set_head_page(cpu_buffer);
struct buffer_page *commit = cpu_buffer->commit_page;
/* In case of error, head will be NULL */
if (unlikely(!head))
return true;
return reader->read == rb_page_commit(reader) &&
(commit == reader ||
(commit == head &&
head->read == rb_page_commit(commit)));
}
| 13,886 |
133,658 | 0 | bool SVGAnimateElement::isAdditive() const
{
if (animationMode() == ByAnimation || animationMode() == FromByAnimation)
if (!animatedPropertyTypeSupportsAddition())
return false;
return SVGAnimationElement::isAdditive();
}
| 13,887 |
147,976 | 0 | void V8TestObject::UnscopableRuntimeEnabledVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_unscopableRuntimeEnabledVoidMethod");
test_object_v8_internal::UnscopableRuntimeEnabledVoidMethodMethod(info);
}
| 13,888 |
96,086 | 0 | void logsignal(int s) {
if (!arg_debug)
return;
openlog("firejail", LOG_NDELAY | LOG_PID, LOG_USER);
syslog(LOG_INFO, "Signal %d caught", s);
closelog();
}
| 13,889 |
62,553 | 0 | atm_print(netdissect_options *ndo,
u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
u_int caplen)
{
if (ndo->ndo_eflag)
ND_PRINT((ndo, "VPI:%u VCI:%u ", vpi, vci));
if (vpi == 0) {
switch (vci) {
case VCI_PPC:
sig_print(ndo, p);
return;
case VCI_BCC:
ND_PRINT((ndo, "broadcast sig: "));
return;
case VCI_OAMF4SC: /* fall through */
case VCI_OAMF4EC:
oam_print(ndo, p, length, ATM_OAM_HEC);
return;
case VCI_METAC:
ND_PRINT((ndo, "meta: "));
return;
case VCI_ILMIC:
ND_PRINT((ndo, "ilmi: "));
snmp_print(ndo, p, length);
return;
}
}
switch (traftype) {
case ATM_LLC:
default:
/*
* Assumes traffic is LLC if unknown.
*/
atm_llc_print(ndo, p, length, caplen);
break;
case ATM_LANE:
lane_print(ndo, p, length, caplen);
break;
}
}
| 13,890 |
32,693 | 0 | static int tg3_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
{
u64 ns;
u32 remainder;
struct tg3 *tp = container_of(ptp, struct tg3, ptp_info);
tg3_full_lock(tp, 0);
ns = tg3_refclk_read(tp);
ns += tp->ptp_adjust;
tg3_full_unlock(tp);
ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder);
ts->tv_nsec = remainder;
return 0;
}
| 13,891 |
187,224 | 1 | static int hid_abort_transfers(int sub_api, struct usbi_transfer *itransfer)
{
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
struct windows_transfer_priv *transfer_priv = (struct windows_transfer_priv*)usbi_transfer_get_os_priv(itransfer);
struct windows_device_handle_priv *handle_priv = _device_handle_priv(transfer->dev_handle);
HANDLE hid_handle;
int current_interface;
CHECK_HID_AVAILABLE;
current_interface = transfer_priv->interface_number;
hid_handle = handle_priv->interface_handle[current_interface].api_handle;
CancelIo(hid_handle);
return LIBUSB_SUCCESS;
}
| 13,892 |
63,239 | 0 | void _WM_do_control_registered_param_fine(struct _mdi *mdi,
struct _event_data *data) {
uint8_t ch = data->channel;
MIDI_EVENT_DEBUG(__FUNCTION__,ch, data->data.value);
mdi->channel[ch].reg_data = (mdi->channel[ch].reg_data & 0x3F80)
| data->data.value;
mdi->channel[ch].reg_non = 0;
}
| 13,893 |
73,489 | 0 | MagickExport const PixelPacket *GetVirtualPixelsFromNexus(const Image *image,
const VirtualPixelMethod virtual_pixel_method,const ssize_t x,const ssize_t y,
const size_t columns,const size_t rows,NexusInfo *nexus_info,
ExceptionInfo *exception)
{
CacheInfo
*magick_restrict cache_info;
IndexPacket
virtual_index;
MagickOffsetType
offset;
MagickSizeType
length,
number_pixels;
NexusInfo
**magick_restrict virtual_nexus;
PixelPacket
*magick_restrict pixels,
virtual_pixel;
RectangleInfo
region;
register const IndexPacket
*magick_restrict virtual_indexes;
register const PixelPacket
*magick_restrict p;
register IndexPacket
*magick_restrict indexes;
register PixelPacket
*magick_restrict q;
register ssize_t
u,
v;
/*
Acquire pixels.
*/
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
cache_info=(CacheInfo *) image->cache;
assert(cache_info->signature == MagickSignature);
if (cache_info->type == UndefinedCache)
return((const PixelPacket *) NULL);
region.x=x;
region.y=y;
region.width=columns;
region.height=rows;
pixels=SetPixelCacheNexusPixels(cache_info,ReadMode,®ion,
(image->clip_mask != (Image *) NULL) || (image->mask != (Image *) NULL) ?
MagickTrue : MagickFalse,nexus_info,exception);
if (pixels == (PixelPacket *) NULL)
return((const PixelPacket *) NULL);
offset=(MagickOffsetType) nexus_info->region.y*cache_info->columns+
nexus_info->region.x;
length=(MagickSizeType) (nexus_info->region.height-1L)*cache_info->columns+
nexus_info->region.width-1L;
number_pixels=(MagickSizeType) cache_info->columns*cache_info->rows;
if ((offset >= 0) && (((MagickSizeType) offset+length) < number_pixels))
if ((x >= 0) && ((ssize_t) (x+columns) <= (ssize_t) cache_info->columns) &&
(y >= 0) && ((ssize_t) (y+rows) <= (ssize_t) cache_info->rows))
{
MagickBooleanType
status;
/*
Pixel request is inside cache extents.
*/
if (nexus_info->authentic_pixel_cache != MagickFalse)
return(pixels);
status=ReadPixelCachePixels(cache_info,nexus_info,exception);
if (status == MagickFalse)
return((const PixelPacket *) NULL);
if ((cache_info->storage_class == PseudoClass) ||
(cache_info->colorspace == CMYKColorspace))
{
status=ReadPixelCacheIndexes(cache_info,nexus_info,exception);
if (status == MagickFalse)
return((const PixelPacket *) NULL);
}
return(pixels);
}
/*
Pixel request is outside cache extents.
*/
q=pixels;
indexes=nexus_info->indexes;
virtual_nexus=AcquirePixelCacheNexus(1);
if (virtual_nexus == (NexusInfo **) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),CacheError,
"UnableToGetCacheNexus","`%s'",image->filename);
return((const PixelPacket *) NULL);
}
switch (virtual_pixel_method)
{
case BlackVirtualPixelMethod:
{
SetPixelRed(&virtual_pixel,0);
SetPixelGreen(&virtual_pixel,0);
SetPixelBlue(&virtual_pixel,0);
SetPixelOpacity(&virtual_pixel,OpaqueOpacity);
break;
}
case GrayVirtualPixelMethod:
{
SetPixelRed(&virtual_pixel,QuantumRange/2);
SetPixelGreen(&virtual_pixel,QuantumRange/2);
SetPixelBlue(&virtual_pixel,QuantumRange/2);
SetPixelOpacity(&virtual_pixel,OpaqueOpacity);
break;
}
case TransparentVirtualPixelMethod:
{
SetPixelRed(&virtual_pixel,0);
SetPixelGreen(&virtual_pixel,0);
SetPixelBlue(&virtual_pixel,0);
SetPixelOpacity(&virtual_pixel,TransparentOpacity);
break;
}
case MaskVirtualPixelMethod:
case WhiteVirtualPixelMethod:
{
SetPixelRed(&virtual_pixel,QuantumRange);
SetPixelGreen(&virtual_pixel,QuantumRange);
SetPixelBlue(&virtual_pixel,QuantumRange);
SetPixelOpacity(&virtual_pixel,OpaqueOpacity);
break;
}
default:
{
virtual_pixel=image->background_color;
break;
}
}
virtual_index=0;
for (v=0; v < (ssize_t) rows; v++)
{
ssize_t
y_offset;
y_offset=y+v;
if ((virtual_pixel_method == EdgeVirtualPixelMethod) ||
(virtual_pixel_method == UndefinedVirtualPixelMethod))
y_offset=EdgeY(y_offset,cache_info->rows);
for (u=0; u < (ssize_t) columns; u+=length)
{
ssize_t
x_offset;
x_offset=x+u;
length=(MagickSizeType) MagickMin(cache_info->columns-x_offset,columns-u);
if (((x_offset < 0) || (x_offset >= (ssize_t) cache_info->columns)) ||
((y_offset < 0) || (y_offset >= (ssize_t) cache_info->rows)) ||
(length == 0))
{
MagickModulo
x_modulo,
y_modulo;
/*
Transfer a single pixel.
*/
length=(MagickSizeType) 1;
switch (virtual_pixel_method)
{
case BackgroundVirtualPixelMethod:
case ConstantVirtualPixelMethod:
case BlackVirtualPixelMethod:
case GrayVirtualPixelMethod:
case TransparentVirtualPixelMethod:
case MaskVirtualPixelMethod:
case WhiteVirtualPixelMethod:
{
p=(&virtual_pixel);
virtual_indexes=(&virtual_index);
break;
}
case EdgeVirtualPixelMethod:
default:
{
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,
EdgeX(x_offset,cache_info->columns),
EdgeY(y_offset,cache_info->rows),1UL,1UL,*virtual_nexus,
exception);
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,
*virtual_nexus);
break;
}
case RandomVirtualPixelMethod:
{
if (cache_info->random_info == (RandomInfo *) NULL)
cache_info->random_info=AcquireRandomInfo();
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,
RandomX(cache_info->random_info,cache_info->columns),
RandomY(cache_info->random_info,cache_info->rows),1UL,1UL,
*virtual_nexus,exception);
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,
*virtual_nexus);
break;
}
case DitherVirtualPixelMethod:
{
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,
DitherX(x_offset,cache_info->columns),
DitherY(y_offset,cache_info->rows),1UL,1UL,*virtual_nexus,
exception);
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,
*virtual_nexus);
break;
}
case TileVirtualPixelMethod:
{
x_modulo=VirtualPixelModulo(x_offset,cache_info->columns);
y_modulo=VirtualPixelModulo(y_offset,cache_info->rows);
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,
x_modulo.remainder,y_modulo.remainder,1UL,1UL,*virtual_nexus,
exception);
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,
*virtual_nexus);
break;
}
case MirrorVirtualPixelMethod:
{
x_modulo=VirtualPixelModulo(x_offset,cache_info->columns);
if ((x_modulo.quotient & 0x01) == 1L)
x_modulo.remainder=(ssize_t) cache_info->columns-
x_modulo.remainder-1L;
y_modulo=VirtualPixelModulo(y_offset,cache_info->rows);
if ((y_modulo.quotient & 0x01) == 1L)
y_modulo.remainder=(ssize_t) cache_info->rows-
y_modulo.remainder-1L;
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,
x_modulo.remainder,y_modulo.remainder,1UL,1UL,*virtual_nexus,
exception);
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,
*virtual_nexus);
break;
}
case CheckerTileVirtualPixelMethod:
{
x_modulo=VirtualPixelModulo(x_offset,cache_info->columns);
y_modulo=VirtualPixelModulo(y_offset,cache_info->rows);
if (((x_modulo.quotient ^ y_modulo.quotient) & 0x01) != 0L)
{
p=(&virtual_pixel);
virtual_indexes=(&virtual_index);
break;
}
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,
x_modulo.remainder,y_modulo.remainder,1UL,1UL,*virtual_nexus,
exception);
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,
*virtual_nexus);
break;
}
case HorizontalTileVirtualPixelMethod:
{
if ((y_offset < 0) || (y_offset >= (ssize_t) cache_info->rows))
{
p=(&virtual_pixel);
virtual_indexes=(&virtual_index);
break;
}
x_modulo=VirtualPixelModulo(x_offset,cache_info->columns);
y_modulo=VirtualPixelModulo(y_offset,cache_info->rows);
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,
x_modulo.remainder,y_modulo.remainder,1UL,1UL,*virtual_nexus,
exception);
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,
*virtual_nexus);
break;
}
case VerticalTileVirtualPixelMethod:
{
if ((x_offset < 0) || (x_offset >= (ssize_t) cache_info->columns))
{
p=(&virtual_pixel);
virtual_indexes=(&virtual_index);
break;
}
x_modulo=VirtualPixelModulo(x_offset,cache_info->columns);
y_modulo=VirtualPixelModulo(y_offset,cache_info->rows);
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,
x_modulo.remainder,y_modulo.remainder,1UL,1UL,*virtual_nexus,
exception);
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,
*virtual_nexus);
break;
}
case HorizontalTileEdgeVirtualPixelMethod:
{
x_modulo=VirtualPixelModulo(x_offset,cache_info->columns);
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,
x_modulo.remainder,EdgeY(y_offset,cache_info->rows),1UL,1UL,
*virtual_nexus,exception);
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,
*virtual_nexus);
break;
}
case VerticalTileEdgeVirtualPixelMethod:
{
y_modulo=VirtualPixelModulo(y_offset,cache_info->rows);
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,
EdgeX(x_offset,cache_info->columns),y_modulo.remainder,1UL,1UL,
*virtual_nexus,exception);
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,
*virtual_nexus);
break;
}
}
if (p == (const PixelPacket *) NULL)
break;
*q++=(*p);
if ((indexes != (IndexPacket *) NULL) &&
(virtual_indexes != (const IndexPacket *) NULL))
*indexes++=(*virtual_indexes);
continue;
}
/*
Transfer a run of pixels.
*/
p=GetVirtualPixelsFromNexus(image,virtual_pixel_method,x_offset,y_offset,
(size_t) length,1UL,*virtual_nexus,exception);
if (p == (const PixelPacket *) NULL)
break;
virtual_indexes=GetVirtualIndexesFromNexus(cache_info,*virtual_nexus);
(void) memcpy(q,p,(size_t) length*sizeof(*p));
q+=length;
if ((indexes != (IndexPacket *) NULL) &&
(virtual_indexes != (const IndexPacket *) NULL))
{
(void) memcpy(indexes,virtual_indexes,(size_t) length*
sizeof(*virtual_indexes));
indexes+=length;
}
}
}
virtual_nexus=DestroyPixelCacheNexus(virtual_nexus,1);
return(pixels);
}
| 13,894 |
74,908 | 0 | _warc_rdhdr(struct archive_read *a, struct archive_entry *entry)
{
#define HDR_PROBE_LEN (12U)
struct warc_s *w = a->format->data;
unsigned int ver;
const char *buf;
ssize_t nrd;
const char *eoh;
/* for the file name, saves some strndup()'ing */
warc_string_t fnam;
/* warc record type, not that we really use it a lot */
warc_type_t ftyp;
/* content-length+error monad */
ssize_t cntlen;
/* record time is the WARC-Date time we reinterpret it as ctime */
time_t rtime;
/* mtime is the Last-Modified time which will be the entry's mtime */
time_t mtime;
start_over:
/* just use read_ahead() they keep track of unconsumed
* bits and bobs for us; no need to put an extra shift in
* and reproduce that functionality here */
buf = __archive_read_ahead(a, HDR_PROBE_LEN, &nrd);
if (nrd < 0) {
/* no good */
archive_set_error(
&a->archive, ARCHIVE_ERRNO_MISC,
"Bad record header");
return (ARCHIVE_FATAL);
} else if (buf == NULL) {
/* there should be room for at least WARC/bla\r\n
* must be EOF therefore */
return (ARCHIVE_EOF);
}
/* looks good so far, try and find the end of the header now */
eoh = _warc_find_eoh(buf, nrd);
if (eoh == NULL) {
/* still no good, the header end might be beyond the
* probe we've requested, but then again who'd cram
* so much stuff into the header *and* be 28500-compliant */
archive_set_error(
&a->archive, ARCHIVE_ERRNO_MISC,
"Bad record header");
return (ARCHIVE_FATAL);
}
ver = _warc_rdver(buf, eoh - buf);
/* we currently support WARC 0.12 to 1.0 */
if (ver == 0U) {
archive_set_error(
&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid record version");
return (ARCHIVE_FATAL);
} else if (ver < 1200U || ver > 10000U) {
archive_set_error(
&a->archive, ARCHIVE_ERRNO_MISC,
"Unsupported record version: %u.%u",
ver / 10000, (ver % 10000) / 100);
return (ARCHIVE_FATAL);
}
cntlen = _warc_rdlen(buf, eoh - buf);
if (cntlen < 0) {
/* nightmare! the specs say content-length is mandatory
* so I don't feel overly bad stopping the reader here */
archive_set_error(
&a->archive, EINVAL,
"Bad content length");
return (ARCHIVE_FATAL);
}
rtime = _warc_rdrtm(buf, eoh - buf);
if (rtime == (time_t)-1) {
/* record time is mandatory as per WARC/1.0,
* so just barf here, fast and loud */
archive_set_error(
&a->archive, EINVAL,
"Bad record time");
return (ARCHIVE_FATAL);
}
/* let the world know we're a WARC archive */
a->archive.archive_format = ARCHIVE_FORMAT_WARC;
if (ver != w->pver) {
/* stringify this entry's version */
archive_string_sprintf(&w->sver,
"WARC/%u.%u", ver / 10000, (ver % 10000) / 100);
/* remember the version */
w->pver = ver;
}
/* start off with the type */
ftyp = _warc_rdtyp(buf, eoh - buf);
/* and let future calls know about the content */
w->cntlen = cntlen;
w->cntoff = 0U;
mtime = 0;/* Avoid compiling error on some platform. */
switch (ftyp) {
case WT_RSRC:
case WT_RSP:
/* only try and read the filename in the cases that are
* guaranteed to have one */
fnam = _warc_rduri(buf, eoh - buf);
/* check the last character in the URI to avoid creating
* directory endpoints as files, see Todo above */
if (fnam.len == 0 || fnam.str[fnam.len - 1] == '/') {
/* break here for now */
fnam.len = 0U;
fnam.str = NULL;
break;
}
/* bang to our string pool, so we save a
* malloc()+free() roundtrip */
if (fnam.len + 1U > w->pool.len) {
w->pool.len = ((fnam.len + 64U) / 64U) * 64U;
w->pool.str = realloc(w->pool.str, w->pool.len);
}
memcpy(w->pool.str, fnam.str, fnam.len);
w->pool.str[fnam.len] = '\0';
/* let no one else know about the pool, it's a secret, shhh */
fnam.str = w->pool.str;
/* snarf mtime or deduce from rtime
* this is a custom header added by our writer, it's quite
* hard to believe anyone else would go through with it
* (apart from being part of some http responses of course) */
if ((mtime = _warc_rdmtm(buf, eoh - buf)) == (time_t)-1) {
mtime = rtime;
}
break;
default:
fnam.len = 0U;
fnam.str = NULL;
break;
}
/* now eat some of those delicious buffer bits */
__archive_read_consume(a, eoh - buf);
switch (ftyp) {
case WT_RSRC:
case WT_RSP:
if (fnam.len > 0U) {
/* populate entry object */
archive_entry_set_filetype(entry, AE_IFREG);
archive_entry_copy_pathname(entry, fnam.str);
archive_entry_set_size(entry, cntlen);
archive_entry_set_perm(entry, 0644);
/* rtime is the new ctime, mtime stays mtime */
archive_entry_set_ctime(entry, rtime, 0L);
archive_entry_set_mtime(entry, mtime, 0L);
break;
}
/* FALLTHROUGH */
default:
/* consume the content and start over */
_warc_skip(a);
goto start_over;
}
return (ARCHIVE_OK);
}
| 13,895 |
167,022 | 0 | bool NavigationControllerImpl::NavigateToPendingEntryInternal(
ReloadType reload_type,
std::unique_ptr<NavigationUIData> navigation_ui_data) {
DCHECK(pending_entry_);
FrameTreeNode* root = delegate_->GetFrameTree()->root();
FrameLoadVector same_document_loads;
FrameLoadVector different_document_loads;
if (GetLastCommittedEntry()) {
FindFramesToNavigate(root, &same_document_loads, &different_document_loads);
}
if (same_document_loads.empty() && different_document_loads.empty()) {
different_document_loads.push_back(
std::make_pair(root, pending_entry_->GetFrameEntry(root)));
}
bool success = false;
for (const auto& item : same_document_loads) {
FrameTreeNode* frame = item.first;
DCHECK(!IsRendererDebugURL(item.second->url()));
std::unique_ptr<NavigationRequest> request = CreateNavigationRequest(
frame, *pending_entry_, item.second, reload_type,
true /* is_same_document_history_load */,
false /* is_history_navigation_in_new_child */, nullptr, nullptr);
if (request) {
success = true;
frame->navigator()->Navigate(std::move(request), reload_type,
pending_entry_->restore_type());
}
}
for (const auto& item : different_document_loads) {
FrameTreeNode* frame = item.first;
if (IsRendererDebugURL(item.second->url())) {
HandleRendererDebugURL(frame, item.second->url());
if (!item.second->url().SchemeIs(url::kJavaScriptScheme)) {
success = true;
}
} else {
std::unique_ptr<NavigationRequest> request = CreateNavigationRequest(
frame, *pending_entry_, item.second, reload_type,
false /* is_same_document_history_load */,
false /* is_history_navigation_in_new_child */, nullptr,
frame->IsMainFrame() ? std::move(navigation_ui_data) : nullptr);
if (request) {
success = true;
frame->navigator()->Navigate(std::move(request), reload_type,
pending_entry_->restore_type());
}
}
}
return success;
}
| 13,896 |
30,756 | 0 | void bt_procfs_cleanup(struct net *net, const char *name)
{
}
| 13,897 |
81,238 | 0 | static void __trace_find_cmdline(int pid, char comm[])
{
unsigned map;
if (!pid) {
strcpy(comm, "<idle>");
return;
}
if (WARN_ON_ONCE(pid < 0)) {
strcpy(comm, "<XXX>");
return;
}
if (pid > PID_MAX_DEFAULT) {
strcpy(comm, "<...>");
return;
}
map = savedcmd->map_pid_to_cmdline[pid];
if (map != NO_CMDLINE_MAP)
strlcpy(comm, get_saved_cmdlines(map), TASK_COMM_LEN);
else
strcpy(comm, "<...>");
}
| 13,898 |
25,263 | 0 | static inline u32 armv7_pmnc_enable_counter(unsigned int idx)
{
u32 val;
if ((idx != ARMV7_CYCLE_COUNTER) &&
((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST))) {
pr_err("CPU%u enabling wrong PMNC counter"
" %d\n", smp_processor_id(), idx);
return -1;
}
if (idx == ARMV7_CYCLE_COUNTER)
val = ARMV7_CNTENS_C;
else
val = ARMV7_CNTENS_P(idx);
asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (val));
return idx;
}
| 13,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.