Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(912)

Side by Side Diff: chromecast/browser/service/cast_service_simple.cc

Issue 1068793002: Fixed "blocking io" from FixupPath on UI thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed adding cwd aka "blocking IO" used in FixupURL via FilePathToFileURL, also fixed client code Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromecast/browser/service/cast_service_simple.h" 5 #include "chromecast/browser/service/cast_service_simple.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h"
8 #include "chromecast/browser/cast_content_window.h" 9 #include "chromecast/browser/cast_content_window.h"
9 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
11 #include "net/base/filename_util.h" 12 #include "net/base/filename_util.h"
12 #include "net/url_request/url_request_context_getter.h" 13 #include "net/url_request/url_request_context_getter.h"
13 14
14 namespace chromecast { 15 namespace chromecast {
15 16
16 namespace { 17 namespace {
17 18
18 GURL GetStartupURL() { 19 GURL GetStartupURL() {
19 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 20 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
20 const base::CommandLine::StringVector& args = command_line->GetArgs(); 21 const base::CommandLine::StringVector& args = command_line->GetArgs();
21 22
22 if (args.empty()) 23 if (args.empty())
23 return GURL("http://www.google.com/"); 24 return GURL("http://www.google.com/");
24 25
25 GURL url(args[0]); 26 GURL url(args[0]);
26 if (url.is_valid() && url.has_scheme()) 27 if (url.is_valid() && url.has_scheme())
27 return url; 28 return url;
28 29
29 return net::FilePathToFileURL(base::FilePath(args[0])); 30 return net::FilePathToFileURL(
Peter Kasting 2015/04/22 22:40:04 Both this and shell_browser_main_parts.cc should b
31 base::MakeAbsoluteFilePath(base::FilePath(args[0])));
30 } 32 }
31 33
32 } // namespace 34 } // namespace
33 35
34 // static 36 // static
35 scoped_ptr<CastService> CastService::Create( 37 scoped_ptr<CastService> CastService::Create(
36 content::BrowserContext* browser_context, 38 content::BrowserContext* browser_context,
37 PrefService* pref_service, 39 PrefService* pref_service,
38 metrics::CastMetricsServiceClient* metrics_service_client, 40 metrics::CastMetricsServiceClient* metrics_service_client,
39 net::URLRequestContextGetter* request_context_getter) { 41 net::URLRequestContextGetter* request_context_getter) {
(...skipping 20 matching lines...) Expand all
60 } 62 }
61 63
62 void CastServiceSimple::StartInternal() { 64 void CastServiceSimple::StartInternal() {
63 // This is the simple version that hard-codes the size. 65 // This is the simple version that hard-codes the size.
64 gfx::Size initial_size(1280, 720); 66 gfx::Size initial_size(1280, 720);
65 67
66 window_.reset(new CastContentWindow); 68 window_.reset(new CastContentWindow);
67 web_contents_ = window_->CreateWebContents(initial_size, browser_context()); 69 web_contents_ = window_->CreateWebContents(initial_size, browser_context());
68 window_->CreateWindowTree(initial_size, web_contents_.get()); 70 window_->CreateWindowTree(initial_size, web_contents_.get());
69 71
70 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(), 72 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(),
Peter Kasting 2015/04/22 22:40:04 This call should be guarded by an "if (startup_url
71 ui::PAGE_TRANSITION_TYPED, 73 ui::PAGE_TRANSITION_TYPED,
72 std::string()); 74 std::string());
73 } 75 }
74 76
75 void CastServiceSimple::StopInternal() { 77 void CastServiceSimple::StopInternal() {
76 web_contents_->GetRenderViewHost()->ClosePage(); 78 web_contents_->GetRenderViewHost()->ClosePage();
77 web_contents_.reset(); 79 web_contents_.reset();
78 window_.reset(); 80 window_.reset();
79 } 81 }
80 82
81 } // namespace chromecast 83 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698