当前位置: 首页>>代码示例>>C++>>正文


C++ do_GetIOService函数代码示例

本文整理汇总了C++中do_GetIOService函数的典型用法代码示例。如果您正苦于以下问题:C++ do_GetIOService函数的具体用法?C++ do_GetIOService怎么用?C++ do_GetIOService使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了do_GetIOService函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: uri

bool
WyciwygChannelParent::RecvInit(const IPC::URI& aURI)
{
  nsresult rv;

  nsCOMPtr<nsIURI> uri(aURI);

  nsCString uriSpec;
  uri->GetSpec(uriSpec);
  LOG(("WyciwygChannelParent RecvInit [this=%x uri=%s]\n",
       this, uriSpec.get()));

  nsCOMPtr<nsIIOService> ios(do_GetIOService(&rv));
  if (NS_FAILED(rv))
    return SendCancelEarly(rv);

  nsCOMPtr<nsIChannel> chan;
  rv = NS_NewChannel(getter_AddRefs(chan), uri, ios);
  if (NS_FAILED(rv))
    return SendCancelEarly(rv);

  mChannel = do_QueryInterface(chan, &rv);
  if (NS_FAILED(rv))
    return SendCancelEarly(rv);

  return true;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:27,代码来源:WyciwygChannelParent.cpp

示例2: do_GetIOService

nsresult
nsResProtocolHandler::Init()
{
    if (!mSubstitutions.Init(32))
        return NS_ERROR_UNEXPECTED;

    nsresult rv;

    mIOService = do_GetIOService(&rv);
    NS_ENSURE_SUCCESS(rv, rv);

    //
    // make resource:/// point to the application directory
    //
    rv = AddSpecialDir(NS_OS_CURRENT_PROCESS_DIR, EmptyCString());
    NS_ENSURE_SUCCESS(rv, rv);

    //
    // make resource://gre/ point to the GRE directory
    //
    rv = AddSpecialDir(NS_GRE_DIR, NS_LITERAL_CSTRING("gre"));
    NS_ENSURE_SUCCESS(rv, rv);

    //XXXbsmedberg Neil wants a resource://pchrome/ for the profile chrome dir...
    // but once I finish multiple chrome registration I'm not sure that it is needed

    return rv;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:28,代码来源:nsResProtocolHandler.cpp

示例3: ioService

void CTests::OnTestsIOServiceNewURI()
{
	nsCOMPtr<nsIIOService> ioService(do_GetIOService(&rv));
	if (!ioService) {
		QAOutput("We didn't get the IOService object.", 2);
		return;
	}

	if (myDialog.DoModal() == IDOK)
	{
		nsCAutoString theStr, retURI;

		theStr = myDialog.m_urlfield;

		rv = ioService->NewURI(theStr, nsnull, nsnull, getter_AddRefs(theURI));
		RvTestResult(rv, "ioService->NewURI() test", 2);

		if (!theURI)
			QAOutput("We didn't get the nsIURI object for IOService test.", 2);
		else {
			retURI = GetTheURI(theURI, 1);
			FormatAndPrintOutput("The ioService->NewURI() output uri = ", retURI, 2);
		}
	}
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:25,代码来源:Tests.cpp

示例4: do_GetIOService

void
SubstitutingProtocolHandler::ConstructInternal()
{
  nsresult rv;
  mIOService = do_GetIOService(&rv);
  MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv) && mIOService);
}
开发者ID:ChaOSChriS,项目名称:gecko-dev,代码行数:7,代码来源:SubstitutingProtocolHandler.cpp

示例5: ProcessPendingQ

void
nsPACMan::StartLoading()
{
  mLoadPending = false;

  // CancelExistingLoad was called...
  if (!mLoader) {
    ProcessPendingQ(NS_ERROR_ABORT);
    return;
  }

  if (NS_SUCCEEDED(mLoader->Init(this))) {
    // Always hit the origin server when loading PAC.
    nsCOMPtr<nsIIOService> ios = do_GetIOService();
    if (ios) {
      nsCOMPtr<nsIChannel> channel;

      // NOTE: This results in GetProxyForURI being called
      ios->NewChannelFromURI(mPACURI, getter_AddRefs(channel));

      if (channel) {
        channel->SetLoadFlags(nsIRequest::LOAD_BYPASS_CACHE);
        channel->SetNotificationCallbacks(this);
        if (NS_SUCCEEDED(channel->AsyncOpen(mLoader, nsnull)))
          return;
      }
    }
  }

  CancelExistingLoad();
  ProcessPendingQ(NS_ERROR_UNEXPECTED);
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:32,代码来源:nsPACMan.cpp

示例6: io

void
nsChromeRegistryContent::RegisterResource(const ResourceMapping& aResource)
{
  nsCOMPtr<nsIIOService> io (do_GetIOService());
  if (!io)
    return;

  nsCOMPtr<nsIProtocolHandler> ph;
  nsresult rv = io->GetProtocolHandler("resource", getter_AddRefs(ph));
  if (NS_FAILED(rv))
    return;
  
  nsCOMPtr<nsIResProtocolHandler> rph (do_QueryInterface(ph));
  if (!rph)
    return;

  nsCOMPtr<nsIURI> resolvedURI;
  if (aResource.resolvedURI.spec.Length()) {
    nsresult rv = NS_NewURI(getter_AddRefs(resolvedURI),
                            aResource.resolvedURI.spec,
                            aResource.resolvedURI.charset.get(),
                            nullptr, io);                 
    if (NS_FAILED(rv))
      return;
  }

  rv = rph->SetSubstitution(aResource.resource, resolvedURI);
  if (NS_FAILED(rv))
    return;
}
开发者ID:Incognito,项目名称:mozilla-central,代码行数:30,代码来源:nsChromeRegistryContent.cpp

示例7: io

void
nsChromeRegistryContent::RegisterSubstitution(const SubstitutionMapping& aSubstitution)
{
  nsCOMPtr<nsIIOService> io (do_GetIOService());
  if (!io)
    return;

  nsCOMPtr<nsIProtocolHandler> ph;
  nsresult rv = io->GetProtocolHandler(aSubstitution.scheme.get(), getter_AddRefs(ph));
  if (NS_FAILED(rv))
    return;

  nsCOMPtr<nsISubstitutingProtocolHandler> sph (do_QueryInterface(ph));
  if (!sph)
    return;

  nsCOMPtr<nsIURI> resolvedURI;
  if (aSubstitution.resolvedURI.spec.Length()) {
    rv = NS_NewURI(getter_AddRefs(resolvedURI),
                   aSubstitution.resolvedURI.spec,
                   aSubstitution.resolvedURI.charset.get(),
                   nullptr, io);
    if (NS_FAILED(rv))
      return;
  }

  rv = sph->SetSubstitution(aSubstitution.path, resolvedURI);
  if (NS_FAILED(rv))
    return;
}
开发者ID:InternalError503,项目名称:cyberfox,代码行数:30,代码来源:nsChromeRegistryContent.cpp

示例8: ios

NS_IMETHODIMP
nsAboutFeeds::NewChannel(nsIURI* uri, nsIChannel** result)
{

  nsresult rv;
  nsCOMPtr<nsIIOService> ios(do_GetIOService(&rv));
  if (NS_FAILED(rv))
    return rv;

  nsCOMPtr<nsIChannel> channel;
  rv = ios->NewChannel(NS_LITERAL_CSTRING(FEEDS_PAGE_URI),
                       nsnull, nsnull, getter_AddRefs(channel));
  if (NS_FAILED(rv))
    return rv;

  channel->SetOriginalURI(uri);

  nsCOMPtr<nsIScriptSecurityManager> ssm =
    do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
  if (NS_FAILED(rv))
    return rv;

  nsCOMPtr<nsIPrincipal> principal;
  rv = ssm->GetCodebasePrincipal(uri, getter_AddRefs(principal));
  if (NS_FAILED(rv))
    return rv;

  rv = channel->SetOwner(principal);
  if (NS_FAILED(rv))
    return rv;

  NS_ADDREF(*result = channel);
  return NS_OK;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:34,代码来源:nsAboutFeeds.cpp

示例9: do_GetIOService

NS_IMETHODIMP
nsURIChecker::Init(nsIURI *aURI)
{
    nsresult rv;
    nsCOMPtr<nsIIOService> ios = do_GetIOService(&rv);
    if (NS_FAILED(rv)) return rv;

    rv = ios->NewChannelFromURI(aURI, getter_AddRefs(mChannel));
    if (NS_FAILED(rv)) return rv;

    if (mAllowHead) {
        mAllowHead = false;
        // See if it's an http channel, which needs special treatment:
        nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
        if (httpChannel) {
            // We can have an HTTP channel that has a non-HTTP URL if
            // we're doing FTP via an HTTP proxy, for example.  See for
            // example bug 148813
            bool isReallyHTTP = false;
            aURI->SchemeIs("http", &isReallyHTTP);
            if (!isReallyHTTP)
                aURI->SchemeIs("https", &isReallyHTTP);
            if (isReallyHTTP) {
                httpChannel->SetRequestMethod(NS_LITERAL_CSTRING("HEAD"));
                // set back to true so we'll know that this request is issuing
                // a HEAD request.  this is used down in OnStartRequest to
                // handle cases where we need to repeat the request as a normal
                // GET to deal with server borkage.
                mAllowHead = true;
            }
        }
    }
    return NS_OK;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:34,代码来源:nsURIChecker.cpp

示例10: do_GetIOService

bool
mozTXTToHTMLConv::CheckURLAndCreateHTML(
     const nsString& txtURL, const nsString& desc, const modetype mode,
     nsString& outputHTML)
{
  // Create *uri from txtURL
  nsCOMPtr<nsIURI> uri;
  nsresult rv;
  // Lazily initialize mIOService
  if (!mIOService)
  {
    mIOService = do_GetIOService();

    if (!mIOService)
      return false;
  }

  // See if the url should be linkified.
  NS_ConvertUTF16toUTF8 utf8URL(txtURL);
  if (!ShouldLinkify(utf8URL))
    return false;

  // it would be faster if we could just check to see if there is a protocol
  // handler for the url and return instead of actually trying to create a url...
  rv = mIOService->NewURI(utf8URL, nsnull, nsnull, getter_AddRefs(uri));

  // Real work
  if (NS_SUCCEEDED(rv) && uri)
  {
    outputHTML.AssignLiteral("<a class=\"moz-txt-link-");
    switch(mode)
    {
    case RFC1738:
      outputHTML.AppendLiteral("rfc1738");
      break;
    case RFC2396E:
      outputHTML.AppendLiteral("rfc2396E");
      break;
    case freetext:
      outputHTML.AppendLiteral("freetext");
      break;
    case abbreviated:
      outputHTML.AppendLiteral("abbreviated");
      break;
    default: break;
    }
    nsAutoString escapedURL(txtURL);
    EscapeStr(escapedURL, true);

    outputHTML.AppendLiteral("\" href=\"");
    outputHTML += escapedURL;
    outputHTML.AppendLiteral("\">");
    outputHTML += desc;
    outputHTML.AppendLiteral("</a>");
    return true;
  }
  else
    return false;
}
开发者ID:marshall,项目名称:mozilla-central,代码行数:59,代码来源:mozTXTToHTMLConv.cpp

示例11: IsOffline

static PRBool
IsOffline()
{
    PRBool offline = PR_TRUE;
    nsCOMPtr<nsIIOService> ios(do_GetIOService());
    if (ios)
        ios->GetOffline(&offline);
    return offline;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:9,代码来源:nsWebShell.cpp

示例12: pService

NS_INTERFACE_MAP_END

nsresult
nsViewSourceChannel::Init(nsIURI* uri)
{
    mOriginalURI = uri;

    nsAutoCString path;
    nsresult rv = uri->GetPath(path);
    if (NS_FAILED(rv))
      return rv;

    nsCOMPtr<nsIIOService> pService(do_GetIOService(&rv));
    if (NS_FAILED(rv)) return rv;

    nsAutoCString scheme;
    rv = pService->ExtractScheme(path, scheme);
    if (NS_FAILED(rv))
      return rv;

    // prevent viewing source of javascript URIs (see bug 204779)
    if (scheme.LowerCaseEqualsLiteral("javascript")) {
      NS_WARNING("blocking view-source:javascript:");
      return NS_ERROR_INVALID_ARG;
    }

    // This function is called from within nsViewSourceHandler::NewChannel2
    // and sets the right loadInfo right after returning from this function.
    // Until then we follow the principal of least privilege and use
    // nullPrincipal as the loadingPrincipal.
    nsCOMPtr<nsIPrincipal> nullPrincipal = nsNullPrincipal::Create();
    NS_ENSURE_TRUE(nullPrincipal, NS_ERROR_FAILURE);

    rv = pService->NewChannel2(path,
                               nullptr, // aOriginCharset
                               nullptr, // aCharSet
                               nullptr, // aLoadingNode
                               nullPrincipal,
                               nullptr, // aTriggeringPrincipal
                               nsILoadInfo::SEC_NORMAL,
                               nsIContentPolicy::TYPE_OTHER,
                               getter_AddRefs(mChannel));
    NS_ENSURE_SUCCESS(rv, rv);

    mIsSrcdocChannel = false;

    mChannel->SetOriginalURI(mOriginalURI);
    mHttpChannel = do_QueryInterface(mChannel);
    mHttpChannelInternal = do_QueryInterface(mChannel);
    mCachingChannel = do_QueryInterface(mChannel);
    mCacheInfoChannel = do_QueryInterface(mChannel);
    mApplicationCacheChannel = do_QueryInterface(mChannel);
    mUploadChannel = do_QueryInterface(mChannel);
    mPostChannel = do_QueryInterface(mChannel);
    
    return NS_OK;
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:57,代码来源:nsViewSourceChannel.cpp

示例13: GetIOService

inline
nsCOMPtr<nsIIOService> GetIOService(nsresult & rv)
{
  // Get the IO service.
  if (NS_IsMainThread()) {
    return do_GetIOService(&rv);
  }
  return do_ProxiedGetService(NS_IOSERVICE_CONTRACTID, &rv);
}
开发者ID:AntoineTurmel,项目名称:nightingale-hacking,代码行数:9,代码来源:sbFileUtils.cpp

示例14: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP
nsAboutRedirector::NewChannel(nsIURI *aURI, nsIChannel **result)
{
    NS_ENSURE_ARG_POINTER(aURI);
    NS_ASSERTION(result, "must not be null");

    nsresult rv;

    nsCAutoString path;
    rv = NS_GetAboutModuleName(aURI, path);
    if (NS_FAILED(rv))
        return rv;

    nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
    if (NS_FAILED(rv))
        return rv;

    for (int i=0; i<kRedirTotal; i++) 
    {
        if (!strcmp(path.get(), kRedirMap[i].id))
        {
            nsCOMPtr<nsIChannel> tempChannel;
            rv = ioService->NewChannel(nsDependentCString(kRedirMap[i].url),
                                       nsnull, nsnull, getter_AddRefs(tempChannel));
            if (NS_FAILED(rv))
                return rv;

            tempChannel->SetOriginalURI(aURI);

            // Keep the page from getting unnecessary privileges unless it needs them
            if (kRedirMap[i].flags &
                nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT)
            {
                nsCOMPtr<nsIScriptSecurityManager> securityManager = 
                         do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
                if (NS_FAILED(rv))
                    return rv;
            
                nsCOMPtr<nsIPrincipal> principal;
                rv = securityManager->GetCodebasePrincipal(aURI, getter_AddRefs(principal));
                if (NS_FAILED(rv))
                    return rv;
            
                rv = tempChannel->SetOwner(principal);
                if (NS_FAILED(rv))
                    return rv;
            }

            NS_ADDREF(*result = tempChannel);
            return rv;
        }
    }

    NS_ERROR("nsAboutRedirector called for unknown case");
    return NS_ERROR_ILLEGAL_VALUE;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:56,代码来源:nsAboutRedirector.cpp

示例15: NS_ENSURE_ARG_POINTER

nsresult
sbLocalDatabaseLibraryFactory::SetQueryDatabaseFile
                                 (sbIDatabaseQuery* aQuery,
                                  nsIFile*          aDatabaseFile)
{
  NS_ENSURE_ARG_POINTER(aQuery);
  NS_ENSURE_ARG_POINTER(aDatabaseFile);

  nsresult rv;

  nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
  NS_ENSURE_SUCCESS(rv, rv);

  // Figure out a GUID based on the filename. All our database files use the
  // '.db' extension, so if someone requests another extension then that's just
  // too bad.
  nsCOMPtr<nsIURI> fileURI;
  rv = NS_NewFileURI(getter_AddRefs(fileURI), aDatabaseFile, ioService);
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsIURL> fileURL = do_QueryInterface(fileURI, &rv);
  NS_ENSURE_SUCCESS(rv, rv);

  nsCAutoString fileBaseName;
  rv = fileURL->GetFileBaseName(fileBaseName);
  NS_ENSURE_SUCCESS(rv, rv);

  rv = aQuery->SetDatabaseGUID(NS_ConvertUTF8toUTF16(fileBaseName));
  NS_ENSURE_SUCCESS(rv, rv);

#ifdef DEBUG
  // Warn anyone if they passed in an extension other than '.db'.
  nsCAutoString fileExtension;
  rv = fileURL->GetFileExtension(fileExtension);
  if (NS_SUCCEEDED(rv)) {
    if (!fileExtension.IsEmpty() &&
        !fileExtension.Equals("db", CaseInsensitiveCompare)) {
      NS_WARNING("All database files are forced to use the '.db' extension.");
    }
  }
#endif
  // Set the parent directory as the location for the library database file.
  nsCOMPtr<nsIFile> parentDirectory;
  rv = aDatabaseFile->GetParent(getter_AddRefs(parentDirectory));
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsIURI> parentURI;
  rv = NS_NewFileURI(getter_AddRefs(parentURI), parentDirectory, ioService);
  NS_ENSURE_SUCCESS(rv, rv);

  rv = aQuery->SetDatabaseLocation(parentURI);
  NS_ENSURE_SUCCESS(rv, rv);

  return NS_OK;
}
开发者ID:freaktechnik,项目名称:nightingale-hacking,代码行数:55,代码来源:sbLocalDatabaseLibraryFactory.cpp


注:本文中的do_GetIOService函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。